Sending Player to other Script

Hello there,

I want to send the player to another script to set a value on the player using this.

public JGOGameManager GameManager;
.
.
.
GameManager.SendPlayerDone (this);

The recieving code looks like this :

public void SendPlayerDone(JGOPlayer_Physics Player) {
		FinishedPlayers++;

		if(FinishedPlayers == 1)
		{
			StartCoroutine (StartFinishCountdown ());
		}

		Player.SetPlayerPlace(FinishedPlayers);

	}

Unfortunately, my code is not working. I get this error

NullReferenceException: Object reference not set to an instance of an object

How can I send the player himself to the script?

Greetz,
ITGeist.

1 Answer

1

I guess you forgot set GameManager in editor. Code looks fine (workable)

It is already set in Editor and Network Manager is attached to it.