Page 1 of 1

LoadConfig and WebPlayer

Posted: 16 Jun 2011, 13:26
by Twelve47
I'm running SFS2X RC2 with a Unity 3.3 project.

If I run my project in the editor or build as a standalone app everything works as expected.

If I build and run as a Web Player project, it fails to to load the sfs-config.

This is what I see in the Player Log.

Code: Select all

[SFS DEBUG] Failed to load config: Error loading config file: Attempt to access a private/protected method failed.
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
gui_Login:OnDebugMessage(BaseEvent)
Sfs2X.Core.EventDispatcher:DispatchEvent(BaseEvent)
Sfs2X.Logging.Logger:DispatchEvent(LoggerEvent)
Sfs2X.Logging.Logger:Log(LogLevel, String)
Sfs2X.Logging.Logger:Error(String[])
Sfs2X.SmartFox:OnConfigLoadFailure(BaseEvent)
Sfs2X.Core.EventDispatcher:DispatchEvent(BaseEvent)
Sfs2X.Util.ConfigLoader:OnConfigLoadFailure(String)
Sfs2X.Util.ConfigLoader:LoadConfig(String)
Sfs2X.SmartFox:LoadConfig(String, Boolean)
Sfs2X.SmartFox:LoadConfig()
The .html, .unity3d and sfs-config.xml files are all in the same directory.

Any ideas?

Posted: 17 Jun 2011, 14:30
by ThomasLund
Yeah - webplayers are not allowed to load files from the harddrive. I would remove config file usage and set the values in your code and/or inspector

/Thomas

Posted: 17 Jun 2011, 15:15
by Twelve47
Thanks Thomas

How would I go about setting the BlueBox config in code?

If I try setting smartFox.Config.HttpPort, I get a null exception, because config hasn't been set yet.

And if I can't set smartFox.Config to a new ConfigData, because Config is a read only property.

Posted: 28 Jun 2011, 13:37
by Twelve47
(Bump)

If isn't possible to set the HttpPort in code, would it be possible to get a copy of the source code for the SmartFox2 Unity plugin so I could do a customised build with my server details?

Posted: 29 Jun 2011, 02:38
by GRIM2594
Twelve47 wrote:Thanks Thomas

How would I go about setting the BlueBox config in code?

If I try setting smartFox.Config.HttpPort, I get a null exception, because config hasn't been set yet.

And if I can't set smartFox.Config to a new ConfigData, because Config is a read only property.
If you are simply trying to connect your webplayer to a server, you can do this:

(This isn't a full use-as is code snippet, just an example)

Code: Select all

private string serverName = "00.000.00.000"; // IP address connecting to
private int serverPort = 9933; // the port
void Start()
{
     smartFox.Connect(serverName, serverPort);
}

Posted: 29 Jun 2011, 06:12
by Twelve47
That only configures the connection for the socket connection.

Some of our users can only connect via a http proxy on port 80. (The've got a super strict IT policy which is beyond my control). I can set up jetty to use port 80 instead of the default. But now I need to configure my unity project so that if it can't establish a socket connection to host:9933 that it should try to use bluebox at host:80 instead.

Posted: 29 Jun 2011, 09:12
by ThomasLund
Hmmm - my bad. Misreading some of these things going fast over all forum posts.

I didnt immidiately get that the variables are unexposed to the client. Sorry.

I'll add it to the todo list to expose these things to the client

/Thomas

Posted: 29 Jun 2011, 10:59
by Twelve47
Hi Thomas,

Thanks, that helps.

I've been playing with this locally in the mean time.

The BlueBox code uses System.Net.WebClient which in turn uses HttpWebRequest, HttpWebRequest isn't supported in the Web Player Environment anyway. So I don't think BlueBox will ever work in Unity Web Player without a major re working to use the WWW class (if that is even suitable).

Posted: 29 Jun 2011, 19:20
by ThomasLund
*sigh*

"Security" - meh.

I'll put on the list to recode the BB stuff to use sockets and raw http. That might help all issues.

/Thomas