I made what might become a common mistake with active canvas setting

Hi guys, I fell into what might be a common pitfall in future. Instead of only setting the canvas to unactive, I accidentally set the entire gameobject as inactive. This led to me ripping my hair out, wondering why the event was not being subscribed too. Of course, it was because the script was also set to inactive! I’ve not had that user mistake with unity yet and it was a good lesson for me to learn!

4 Likes

I wish I’d seen this 90 min ago - I think this might have been my problem and I just reset my project back to the previous commit to try again. Ah well, you live and learn.

You’re an absolute legend! I’ve been picking at this problem for a couple of days now. Of course, it had to be the simplest thing :wink: Thanks for taking the time to write it up.

I did the same thing, and spent way too long figuring it out too. It’s pretty obvious once you notice it. I don’t have debugging setup with vscode yet, so I dropped debug lines where the event is invoked, where the RpcGameover method is called, and in the ClientHandleGameOver event handler, and could see that everything was running. That made it obvious that gameOverDisplayParent.SetActive wasn’t doing what I thought it should.

I spent a few minutes trying to figure out why SetActive wasn’t setting it active before I stepped back and asked myself what gameOverDisplayParent “is” and then slapped my forehead.

Privacy & Terms