Posted: 21 Sep 2010, 09:51
Super - talking to Lucas from Unity about it. Got the file downloaded and will try to reproduce
/Thomas
/Thomas
SmartFoxServer support forums
https://forums.smartfoxserver.com:443/
Code: Select all
using UnityEngine;
using System.Collections;
using System.Globalization;
public class NewBehaviourScript : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
string message = "..";
void OnGUI() {
if (GUI.Button (new Rect (10,10,100,50), "Test")) {
Debug.Log("Start");
NumberFormatInfo nfi = new CultureInfo("en-US", false).NumberFormat;
double varValue = double.Parse("75.4", nfi);
message = "Value: " + varValue;
}
GUI.Label (new Rect (10,70,100,20), message);
}
}
OK. When I try Security.PrefetchSocketPolicy(serverIP, serverPort); I can connect to SFS, but when I login it immediately logs me back out. When I use the socket policy server that came with Unity I can login, but then it hangs after getting initial response back from SFS. This is only on published web player files. When I run it from the editor it works fine using either socket policy server!ThomasLund wrote:Also note, that you can also use the SFS server to give you the policy file.
What you need to use is:
Security.PrefetchSocketPolicy(serverIP, serverPort);
where serverIP is the hostname of your SFS server and serverPort is the SFS port (usually 9339)
before making any socket connection.
For tutorial 3 code, you can do like this:
Code: Select all
void Awake() { Application.runInBackground = true; if ( SmartFox.IsInitialized() ) { smartFox = SmartFox.Connection; } else { Security.PrefetchSocketPolicy(serverIP, serverPort); try { smartFox = new SmartFoxClient(debug); smartFox.runInQueueMode=true; } catch ( Exception e ) { loginErrorMessage = e.ToString(); } } // Register callback delegate SFSEvent.onConnection += OnConnection; SFSEvent.onConnectionLost += OnConnectionLost; SFSEvent.onLogin += OnLogin; SFSEvent.onRoomListUpdate += OnRoomList; SFSEvent.onDebugMessage += OnDebugMessage; smartFox.Connect(serverIP, serverPort); }
I will try the CultureInfo() fix.ThomasLund wrote:Been testing all day with different variations of standalone policy server and/or SFS server using policy and have not had any problem with it. No difference serving the policy file with either SFS 1.2.6 or SFS2X
When it gets to logging in, the policy part is long past. So must be something else wrong when the server kicks you out
/Thomas
Ok. I did the api fix. Now I can log in using the SFS policy server without immediately getting logged back out, but now it hangs before any players get spawned.ThomasLund wrote:Been testing all day with different variations of standalone policy server and/or SFS server using policy and have not had any problem with it. No difference serving the policy file with either SFS 1.2.6 or SFS2X
When it gets to logging in, the policy part is long past. So must be something else wrong when the server kicks you out
/Thomas
Code: Select all
Platform assembly: C:\Users\Chad\AppData\LocalLow\Unity\WebPlayer\mono\3.x.x\Data\lib\System.dll (this message is harmless)
Platform assembly: C:\Users\Chad\AppData\LocalLow\Unity\WebPlayer\player\3.x.x\Data\lib\CrossDomainPolicyParser.dll (this message is harmless)
Socket connected to 66.240.232.124:9339
Policy for host 66.240.232.124 found in the cache.
Unloading 2 unused Assets to reduce memory usage. Loaded Objects now: 5532.
System memory in use: 280.0 MB.
Unloading 0 Unused Serialized files (Serialized files now loaded: 5 / Dirty serialized files: 1)
Loading WebPlayer Assetbundles
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
CharacterGenerator:get_AssetbundleBaseURL()
CharacterGenerator:get_ReadyToUse()
<Start>c__Iterator2:MoveNext()
(Filename: ..\..\Runtime\Export\Generated\BaseClass.cpp Line: 2551)
About to parse url: http://test.collectaville.com/assetbundles/CharacterElementDatabase.assetbundle
luccheck6
Island Level Started
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
NetworkController:Start()
(Filename: ..\..\Runtime\Export\Generated\BaseClass.cpp Line: 2551)
Joined Room!
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
NetworkController:OnJoinRoom(Room)
SmartFoxClientAPI.SmartFoxClient:_DispatchEvent(SFSEvent)
SmartFoxClientAPI.SmartFoxClient:ProcessEventQueue()
NetworkController:Update()
(Filename: ..\..\Runtime\Export\Generated\BaseClass.cpp Line: 2551)
[SFS DEBUG] ERROR: Exception thrown dispatching event. Exception: System.MethodAccessException: Attempt to access a private/protected method failed.
at System.Security.SecurityManager.ThrowException (System.Exception ex) [0x00000] in <filename unknown>:0
at SmartFoxClientAPI.Util.SFSObjectSerializer.Obj2xml (SmartFoxClientAPI.Data.SFSObject ao, Int32 depth, System.String nodeName, System.Text.StringBuilder xmlData) [0x00000] in <filename unknown>:0
at SmartFoxClientAPI.Util.SFSObjectSerializer.Obj2xml (SmartFoxClientAPI.Data.SFSObject ao, Int32 depth, System.String nodeName, System.Text.StringBuilder xmlData) [0x00000] in <filename unknown>:0
at SmartFoxClientAPI.Util.SFSObjectSerializer.Serialize (SmartFoxClientAPI.Data.SFSObject ao) [0x00000] in <filename unknown>:0
at SmartFoxClientAPI.SmartFoxClient.SendXtMessage (System.String xtName, System.String cmd, ICollection paramObj, System.String type, Int32 roomId) [0x00000] in <filename unknown>:0
at SmartFoxClientAPI.SmartFoxClient.SendXtMessage (System.String xtName, System.String cmd, ICollection paramObj, System.String type) [0x00000] in <filename unknown>:0
at NetworkController.GetServerTime () [0x00000] in <filename unknown>:0
at NetworkController.OnJoinRoom (SmartFoxClientAPI.Data.Room room) [0x00000] in <filename unknown>:0
at SmartFoxClientAPI.SmartFoxClient._DispatchEvent (SmartFoxClientAPI.SFSEvent evt) [0x00000] in <filename unknown>:0
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
LoginGUI:OnDebugMessage(String)
SmartFoxClientAPI.OnDebugMessageDelegate:invoke_void__this___string(String)
SmartFoxClientAPI.SmartFoxClient:_DispatchEvent(SFSEvent)
SmartFoxClientAPI.SmartFoxClient:ProcessEventQueue()
NetworkController:Update()
(Filename: ..\..\Runtime\Export\Generated\BaseClass.cpp Line: 2551)
[SFS DEBUG] ERROR: Exception thrown dispatching event. Exception: System.MethodAccessException: Attempt to access a private/protected method failed.
at System.Security.SecurityManager.ThrowException (System.Exception ex) [0x00000] in <filename unknown>:0
at SmartFoxClientAPI.Util.SFSObjectSerializer.Obj2xml (SmartFoxClientAPI.Data.SFSObject ao, Int32 depth, System.String nodeName, System.Text.StringBuilder xmlData) [0x00000] in <filename unknown>:0
at SmartFoxClientAPI.Util.SFSObjectSerializer.Obj2xml (SmartFoxClientAPI.Data.SFSObject ao, Int32 depth, System.String nodeName, System.Text.StringBuilder xmlData) [0x00000] in <filename unknown>:0
at SmartFoxClientAPI.Util.SFSObjectSerializer.Serialize (SmartFoxClientAPI.Data.SFSObject ao) [0x00000] in <filename unknown>:0
at SmartFoxClientAPI.SmartFoxClient.SendXtMessage (System.String xtName, System.String cmd, ICollection paramObj, System.String type, Int32 roomId) [0x00000] in <filename unknown>:0
at SmartFoxClientAPI.SmartFoxClient.SendXtMessage (System.String xtName, System.String cmd, ICollection paramObj, System.String type) [0x00000] in <filename unknown>:0
at NetworkController.GetServerTime () [0x00000] in <filename unknown>:0
at NetworkController.OnJoinRoom (SmartFoxClientAPI.Data.Room room) [0x00000] in <filename unknown>:0
at SmartFoxClientAPI.SmartFoxClient._DispatchEvent (SmartFoxClientAPI.SFSEvent evt) [0x00000] in <filename unknown>:0
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
NetworkController:OnDebugMessage(String)
SmartFoxClientAPI.OnDebugMessageDelegate:invoke_void__this___string(String)
SmartFoxClientAPI.SmartFoxClient:_DispatchEvent(SFSEvent)
SmartFoxClientAPI.SmartFoxClient:ProcessEventQueue()
NetworkController:Update()
(Filename: ..\..\Runtime\Export\Generated\BaseClass.cpp Line: 2551)
The class defined in script file named 'CharacterElementHolder' does not match the file name!
UnityEngine.AssetBundle:get_mainAsset()
CharacterGenerator:get_ReadyToUse()
<Start>c__Iterator2:MoveNext()
[..\..\Runtime\Mono\MonoBehaviour.cpp line 1553]
(Filename: ..\..\Runtime\Mono\MonoBehaviour.cpp Line: 1553)
NullReferenceException: Object reference not set to an instance of an object
at CharacterGenerator.get_ReadyToUse () [0x00000] in <filename unknown>:0
at PlayerSpawnController+<Start>c__Iterator2.MoveNext () [0x00000] in <filename unknown>:0
(Filename: Line: -1)
Received Get Door Command - Door Id: 3
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
NetworkController:OnExtensionResponse(Object, String)
SmartFoxClientAPI.OnExtensionResponseDelegate:invoke_void__this___object_string(Object, String)
SmartFoxClientAPI.SmartFoxClient:_DispatchEvent(SFSEvent)
SmartFoxClientAPI.SmartFoxClient:ProcessEventQueue()
NetworkController:Update()
(Filename: ..\..\Runtime\Export\Generated\BaseClass.cpp Line: 2551)
Received Get Door Command - Door Id: 4
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
NetworkController:OnExtensionResponse(Object, String)
SmartFoxClientAPI.OnExtensionResponseDelegate:invoke_void__this___object_string(Object, String)
SmartFoxClientAPI.SmartFoxClient:_DispatchEvent(SFSEvent)
SmartFoxClientAPI.SmartFoxClient:ProcessEventQueue()
NetworkController:Update()
(Filename: ..\..\Runtime\Export\Generated\BaseClass.cpp Line: 2551)
Received Get Door Command - Door Id: 6
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
NetworkController:OnExtensionResponse(Object, String)
SmartFoxClientAPI.OnExtensionResponseDelegate:invoke_void__this___object_string(Object, String)
SmartFoxClientAPI.SmartFoxClient:_DispatchEvent(SFSEvent)
SmartFoxClientAPI.SmartFoxClient:ProcessEventQueue()
NetworkController:Update()
(Filename: ..\..\Runtime\Export\Generated\BaseClass.cpp Line: 2551)
Received Get Door Command - Door Id: 4
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
NetworkController:OnExtensionResponse(Object, String)
SmartFoxClientAPI.OnExtensionResponseDelegate:invoke_void__this___object_string(Object, String)
SmartFoxClientAPI.SmartFoxClient:_DispatchEvent(SFSEvent)
SmartFoxClientAPI.SmartFoxClient:ProcessEventQueue()
NetworkController:Update()
(Filename: ..\..\Runtime\Export\Generated\BaseClass.cpp Line: 2551)
Received Get Door Command - Door Id: 1
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
NetworkController:OnExtensionResponse(Object, String)
SmartFoxClientAPI.OnExtensionResponseDelegate:invoke_void__this___object_string(Object, String)
SmartFoxClientAPI.SmartFoxClient:_DispatchEvent(SFSEvent)
SmartFoxClientAPI.SmartFoxClient:ProcessEventQueue()
NetworkController:Update()
(Filename: ..\..\Runtime\Export\Generated\BaseClass.cpp Line: 2551)
Received Get Door Command - Door Id: 5
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
NetworkController:OnExtensionResponse(Object, String)
SmartFoxClientAPI.OnExtensionResponseDelegate:invoke_void__this___object_string(Object, String)
SmartFoxClientAPI.SmartFoxClient:_DispatchEvent(SFSEvent)
SmartFoxClientAPI.SmartFoxClient:ProcessEventQueue()
NetworkController:Update()
(Filename: ..\..\Runtime\Export\Generated\BaseClass.cpp Line: 2551)
Current Time:0
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
NetworkController:syncTrainAnimation(Single, Single, String)
NetworkController:OnExtensionResponse(Object, String)
SmartFoxClientAPI.OnExtensionResponseDelegate:invoke_void__this___object_string(Object, String)
SmartFoxClientAPI.SmartFoxClient:_DispatchEvent(SFSEvent)
SmartFoxClientAPI.SmartFoxClient:ProcessEventQueue()
NetworkController:Update()
(Filename: ..\..\Runtime\Export\Generated\BaseClass.cpp Line: 2551)
New Time:-6.425415E+08
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
NetworkController:syncTrainAnimation(Single, Single, String)
NetworkController:OnExtensionResponse(Object, String)
SmartFoxClientAPI.OnExtensionResponseDelegate:invoke_void__this___object_string(Object, String)
SmartFoxClientAPI.SmartFoxClient:_DispatchEvent(SFSEvent)
SmartFoxClientAPI.SmartFoxClient:ProcessEventQueue()
NetworkController:Update()
(Filename: ..\..\Runtime\Export\Generated\BaseClass.cpp Line: 2551)