Hi,
I was checking some posts about viewing static vars from a Custom Editor but in my case I just need to pull data from a static var I have in a MonoBehaviour class. What I have is this:
MonoBehaviour Class with static var
using UnityEngine;
using System.Collections.Generic;
public class GameData : MonoBehaviour {
public static int score;
}
then in my custom editor class
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
[CustomEditor(typeof(SpriteGUIController))]
public class SpriteGUIEditorController: Editor
{
public override void OnInspectorGUI()
{
score= GameData.score;
}
}
The error I am getting is this: NullReferenceException: Object reference not set to an instance of an object
Any idea what I am doing wrong?
Thanks in advance
Learner