NetworkIdentity objects readyness problem

So the flow goes like this, You choose to host a game and then you are taken to a screen where a random gameboard is generated. It automatically generates an initial board, but you can press a button to gen more if you are not satisfied with the original.

Since the gameboard has a NetworkIdentity component, during the event handler to the ‘host’ button the gameboard has not spawned yet, so the initial board generation fails. I’m calling NetworkManager.StartHost() before I gen the map, but I guess it spawns in another thread and is still not ready when I call the generation routine. I works when I press the button to gen more boards, but not the initial time.

Is there an easy way to now if an object is spawned and ready? I would like to generate an initial game board as soon as the game starts without requiring an additional button press. How should I handle this?

Couldn’t you just call the function that the button calls when you press it on scene load?

Well you can store a reference to your object in scene and check if it’s enabled and active or not and when it is, it’s ready.
Do this in a while loop in a coroutine 10 times a second or something like that.

I suppose I could generate a map during the boards ‘Start’ function. That would probably work.

What I ended up doing is writing my own class that inherits from NetworkManager, and overriding the OnServerReady function to fire off an event. That seems to work as by this time the board has spawned.