(Unity API) About SmartFox.LoadConfig

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

User avatar
Wei
Posts: 50
Joined: 13 Jun 2017, 08:16

(Unity API) About SmartFox.LoadConfig

Postby Wei » 05 Jul 2017, 22:57

I'm using Unity3D API, here is my question, where should I put sfs-config.xml in my project so that LoadConfig could work on both Android and iOS? I put my sfs-config.xml in Asset/Scripts/, but I cannot read the config file on both of Android and iOS. It totally works on Mac or Windows, but how should I do to read it on mobile platform?
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: (Unity API) About SmartFox.LoadConfig

Postby Lapo » 06 Jul 2017, 10:35

Hi,
yes the external configuration won't work on mobile devices.

My suggestion is to do all via code using the ConfigData object to pass the connection parameters to the SmartFox.Connect method.
In other words:

Code: Select all

var cfg = new ConfigData()
cfg.Host = "www.mygamesite.com"
cfg.Port = 9933
cfg.Zone = "MyGameZone"
...
...

var sfs = new SmartFox();
...
sfs.Connect(cfg);


You can learn more details about these objects in the C# doc:
http://docs2x.smartfoxserver.com/api-docs/csharp-doc/

hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Wei
Posts: 50
Joined: 13 Jun 2017, 08:16

Re: (Unity API) About SmartFox.LoadConfig

Postby Wei » 08 Jul 2017, 14:29

Thanks man, now I know what to do.

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 61 guests