Unity 3.0 and SFS API
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
Hi Thomas,
I have tried the SFSIsland Demo with the same configuration that you specified. However, I use a PC with Vista 64 bit and IE8/Google Chrome.
When I run the Unity Editor version of the SFS Island Demo it works fine. No problems. The Novell server shows that the policy is sent to the client.
When I create a webplayer version it crashes after a few seconds. The Novell server, in this case, also shows that the policy file was sent to the client.
I just bought a mac mini so I will try it there to see if that makes any difference.
Steve
I have tried the SFSIsland Demo with the same configuration that you specified. However, I use a PC with Vista 64 bit and IE8/Google Chrome.
When I run the Unity Editor version of the SFS Island Demo it works fine. No problems. The Novell server shows that the policy is sent to the client.
When I create a webplayer version it crashes after a few seconds. The Novell server, in this case, also shows that the policy file was sent to the client.
I just bought a mac mini so I will try it there to see if that makes any difference.
Steve
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
Super simple non-SFS repro case made. So lets see - will try to work with Unity until this sucker is fixed
/Thomas
/Thomas
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);
}
}
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
Got a workaround from the Unity boys - will test that soon. Meanwhile they are looking into a permanent fix.
So if you are in need of a workaround, find all the CultureInfo() calls and remove the , false argument. Seems that this particular overload is flagged unsafe for some weird reason.
BTW. I've quick testet Unity 3 rc1 with SFS2X API and no issues there (crossing fingers).
/Thomas
So if you are in need of a workaround, find all the CultureInfo() calls and remove the , false argument. Seems that this particular overload is flagged unsafe for some weird reason.
BTW. I've quick testet Unity 3 rc1 with SFS2X API and no issues there (crossing fingers).
/Thomas
Hi Thomas,
I cannot find any CultureInfo() calls in the SFSIslandDemo.
Do I need to add a statement, explicitly, if it does not exist?
Also, I am not sure if it is relevant, but I found a reference on the Unity forum that might be of interest,
http://forum.unity3d.com/viewtopic.php?p=399468&highlight=cultureinfo#399468
I cannot find any CultureInfo() calls in the SFSIslandDemo.
Do I need to add a statement, explicitly, if it does not exist?
Also, I am not sure if it is relevant, but I found a reference on the Unity forum that might be of interest,
http://forum.unity3d.com/viewtopic.php?p=399468&highlight=cultureinfo#399468
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
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);
}
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!
Chad
INFO | jvm 1 | 2010/09/21 09:52:44 | 09:52:44.562 - [ FINE ] > User [ chad ] logged in
INFO | jvm 1 | 2010/09/21 09:52:44 | 09:52:44.562 - [ INFO ] > [RedBox] Internal event received: loginRequest
INFO | jvm 1 | 2010/09/21 09:52:44 | [collectaville/functions.as]: Event:userLost
INFO | jvm 1 | 2010/09/21 09:52:44 | 09:52:44.734 - [ INFO ] > [RedBox] Internal event received: userLost
INFO | jvm 1 | 2010/09/21 09:52:44 | 09:52:44.734 - [ FINE ] > User [ chad ] removed
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
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
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
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
I will try the CultureInfo() fix.
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
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.
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)
Return to “.Net / Unity3D API”
Who is online
Users browsing this forum: No registered users and 2 guests