Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

respawn error/freeze/crash (Another NullReferenceException) #12

Open
brikthor opened this issue Jun 12, 2017 · 0 comments
Open

respawn error/freeze/crash (Another NullReferenceException) #12

brikthor opened this issue Jun 12, 2017 · 0 comments

Comments

@brikthor
Copy link

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;
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant