I keep getting this error when I click the Card so I can move it.
NullReferenceException: Object reference not set to an instance of an object CardProspector.OnMouseUpAsButton () (at Assets/__Scripts/CardProspector.cs:17) UnityEngine.SendMouseEvents:DoSendMouseEvents(Int32, Int32)
The exception indicates the following method in my CardProspector
class:
override public void OnMouseUpAsButton() {
Prospector.S.CardClicked(this); // line 17
base.OnMouseUpAsButton();
}
But that variable should have been instantiated by my Prospector
class, the relevant portion of which is shown below:
public class Prospector : MonoBehaviour {
static public Prospector S;
...
...
// Use this for initialization
void awake() {
S = this;
}
...
...
}