SmartFoxServer with Unity Logging issue
Web Technologies
Web Development
2 years ago
5
Star Rating
1
Rating
_x000D_
_x000D_
I have a question about how Debug.Log works in Unity, with SmartFoxServer. I am writing a multiplayer game. The game will always have four players. Due to issues with Unity/Visual Studio, I cannot use the Visual Studio Debugger (It crashes Unity every time I hit a break point). So, I use Debug.Log.
My question is this: When I have four clients running (one is in Unity, the other three are from running the compiled build) and I have a Debug.Log code run, will it run for every instance or just the Unity instance?
FYI, when I do a build, I just do a normal build. I don't have Development Build checked. I am seeing odd behavior when I get a response back from the server. Sometimes, the Debug.Log will print 4 times and sometimes just once. I can debug my Java extension and the break point is only hit once.
Here is some example Unity C# code:
public void OnExtensionResponse(BaseEvent evt) {
string cmd = (string)evt.Params["cmd"];
SFSObject dataObject = (SFSObject)evt.Params["params"];
Debug.Log("Got response from server: " + cmd + " " + dataObject.GetUtfString("gameStatus"));
switch ( cmd ) {
}
Sometimes the Debug.Log code, above, gets called once, sometimes 2 times, or 5 times. Depending on how Logging works, I would expect 1 time (it it only debugs for the Unity version running) or four times (once for each instance of the game running).
thanks
Posted on 16 Aug 2022, this text provides information on Web Development related to Web Technologies. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Take Quiz To Earn Credits!
Turn Your Knowledge into Earnings.