Naturally this won’t call OnClientConnected because the client never connected to a server/host. 
I know, this is not a problem. I need to get OnClientConnected when the same instance is shutdown and then successfully tries to be a host.
If by that you mean you are starting both server/host AND a client in the same instance, that won’t work. Should actually print an error message, something like “session already started” or similar.
What i meant by that is i am doing the chain of actions on the same instance of the game, instead of hosting on one instance and connecting on another.
You may have registered for the events AFTER you started the client/host. That may miss some of the initial events.
Okay, this gave me an idea to check.
This is how i register events. It seems that when i do NetworkManager.Singleton.StartClient();, then shut it down with NetworkManager.Singleton.Shutdown();, and then try to start a host NetworkManager.Singleton.StartHost();, OnNetworkSpawn is not being called, even though it should.
it is not called when i StartClient, since it is not connecting to the host, and then not called when i StartHost.
public override void OnNetworkSpawn()
{
NetworkManager.OnClientConnectedCallback += ClientConnected;
NetworkManager.OnClientDisconnectCallback += ClientDisconnected;
base.OnNetworkSpawn();
}
Is this expected behaviour or is it a bug?
EDIT: Okay it seems that the script that has OnNetworkSpawn is being deleted when i Shutdown(). I will add more once i investigate further.
EDIT2: Okay, the problem is that unity is forcing me to add NetworkObject on the gameObject that has logic for OnNetworkSpawn, upon shutdown that object is being destroyed which is causing the problems.
What is the right way to tackle this issue?