Respawn works find when hard coded, and VS seems to recognize that the field is a float value.
NullReferenceException: Object reference not set to an instance of an object
Player+c__Iterator0.MoveNext () (at Assets/Scripts/Player.cs:83)
Said Line:
yield return new WaitForSeconds(GameManager.instance.matchSettings.respawnTime);
looks like everything is spelled properly, I went into the code and compared all the lines to what I have by copying them into my project and using the Find feature to paste, no discrepancies found.
MatchSettings looks like:
[System.Serializable]
public class MatchSettings {
public float respawnTime = 3f;
}
GameManager (minus Player Tracking field):
using UnityEngine;
using System.Collections.Generic;
public class GameManager : MonoBehaviour {
public static GameManager instance;
public MatchSettings matchSettings;
void Awake ()
{
if (instance != null)
{
Debug.LogError("More than one GameManager in scene.");
} else
{
instance = this;
}
}
Respawn works find when hard coded, and VS seems to recognize that the field is a float value.
NullReferenceException: Object reference not set to an instance of an object Player+c__Iterator0.MoveNext () (at Assets/Scripts/Player.cs:83)
Said Line: yield return new WaitForSeconds(GameManager.instance.matchSettings.respawnTime);
looks like everything is spelled properly, I went into the code and compared all the lines to what I have by copying them into my project and using the Find feature to paste, no discrepancies found.
MatchSettings looks like: [System.Serializable] public class MatchSettings {
}
GameManager (minus Player Tracking field):
using UnityEngine; using System.Collections.Generic;
public class GameManager : MonoBehaviour {