Hi,
I dont think my issue has to do with this episode, but I am not sure what caused it. It started some episodes before I think: When I start the game(MapScene) I get an Error saying:
Exception in OnStartServer:Object reference not set to an instance of an object at RTSPlayer.ServerHandleBuildingSpawned (Building building) [0x00064] in C:\Users\frede\Documents\GameDev\TankOFWarz\Assets\Scripts\Networking\RTSPlayer.cs:175
at (wrapper delegate-invoke) System.Action`1[Building].invoke_void_T(Building)
The Error accures in this code (I put some Debug.Logs in there):
private void ServerHandleBuildingSpawned(Building building)
{
Debug.Log("Trying to build following building: " + building);
if (connectionToClient== null)
Debug.Log(“connection to client is null”);
if(base.connectionToClient == null)
Debug.Log(“connection to base is null”);
else
Debug.Log("connectionID: " + base.connectionToClient.connectionId);
if (building.connectionToClient.connectionId != connectionToClient.connectionId)
return;
myBuildings.Add(building);
}
I marked the critical Line as bold. It seems that the Value for “building.connectionToClient” is null. After using the Debug logs you can see above I realized, that this method gets called three times. The first two times it seems to work (“building.connectionToClient” and “connectionToClient” is not null) but the third time it causes the error. Do you have an Idea where my problem could be? I checked the code and compared it with the code in the git repository and could not find the cause for this issue.
Sry for the long text and thx in advance if you have an Idea what could help
Kind regards
Frederick