Got an interesting one. FYI I’ve noticed it happening before… but I’ve worked around it (thinking it was my coding/logic arranging). However it’s happening with something crucial, and I’m stuck!
Basically I’m having Gameobjects (and therefore the scripts that are attached to them) getting disabled as soon as I start my game.
I’m going to try and attach a video (possibly youtube link) when I can. (LINKED BELOW)
FYI the Awake() function is called, but not the Start() function. Plus I’m 99.9% sure that I have NOT disabled the gamecontroller in code.
Has anyone had experience of this happening? As I’ve said I think I’ve noticed it happening a couple of times already… but have worked around it…
Long story short… It’s the network identity causing the issues… But I NEED the Network identity to make sure that ONLY the Servers Game Controller is start the rounds… (Plus other things like assigning correct player numbers)… right?
I’ve done a quick search on Google and been pointed to the Scene Objects page… however this doesn’t make a whole lot of sense, nor tell me EXACLTY how to overcome this. Admittedly I have been at it all day (with a Brain Fog addled brain) so I prob should leave til tomorrow… but if anyone has some simple pointers or links to good instructive pages I would be MOST appreciative…
Many thanks for the reply. Yes, after re-reading the Scene objects page that makes total sense! Thanks for that - I knew I needed sleep, lol.
However, where do I run this?
So far I’ve tried running it in the awake command of the GameController (doesn’t work), in a Command that’s called from the Awake function (doesn’t work AND produces an error about “Command function … called on server” - not helpful) and in a script that’s attached to the NetworkManager which checks each update to see if it has been spawned. If it hasn’t spawned it runs the SpawnObjects function.
So far zip, nadda, zilch. Can I ask for some more advice on this? Sorry to be so helpless. Again the documentation has little to nothing on how to use this except ‘run from server’… and so far that isn’t working…
But technically I haven’t even STARTED a server, so how can I perform a server command/rpc? I’m just on the starting menu page… Is this also why I’m getting that error about “Command function … called on server”?
Clicking the Start Host button in the NetworkManager GUI will start a server and automatically connect a local client. I think the NetworkManager also automatically spawns in scene objects.
If you haven’t done any UNet tutorials yet, this is a pretty good series to start with.
Hi @Iron-Warrior
Many thanks I’ll look at those tutorials.
I’ve gone through several already (Unity’s own and GTGD’s tutorial)… but scene objects is something that neither of them covered… as yet. I will admit that I never COMPLETED the Unity text tutorial. I’ll prob give that a full bash soon. (To be fair, I’d forgotten about it until you mentioned tutorials, lol).
Many thanks for the link! I appreciate the assistance.