Player Singleton - no player object created

Hi, i’ve added code from the lesson, but i’ve got no player on scene loading.
I’ve double checked there is no typo, but still can’t get what is wrong.
It’s the singleton class:

And this is the Player:

This is what i have in the editor screen:

One more thing, clicked the link under the “Resources” and looks like the commit is deleted.

I don’t see a player at all. This is a dumb question (but I have to make sure); Is the player in the scene before you start?

Sorry for bothering you, looks like i’ve made a bug by myself. I’ve had 2 “Player” scripts attached to the object.
Removing one of them fixed an issue :flushed:.

1 Like

No, this is how we learn. :slight_smile:
Here’s a handy trick to ensure that this doesn’t happen again. Add this immediately above the Class declaration


This Attribute will instruct Unity to prevent you from putting a second copy of that script on a GameObject.


Privacy & Terms