Hello! I have been trying to get one script to read input from another. I have this script so far:
The sender script:
using UnityEngine;
using System.Collections;
public class Test: MonoBehaviour
{
public jumpAfterTest _jumpAfterTest;
void OnMouseDown()
{
Debug.Log ("Mouse Down");
_jumpAfterTest.JAT ();
}
void OnMouseUp()
{
Debug.Log ("Mouse up");
}
}
And the receiver script:
using UnityEngine;
using System.Collections;
public class jumpAfterTest : MonoBehaviour
{
public void JAT()
{
Debug.Log("Me is JAT");
}
}
The error I am getting is:
NullReferenceException: Object reference not set to an instance of an object
Test.OnMouseDown () (at Assets/my-scripts/Test.cs:13)
UnityEngine.SendMouseEvents:DoSendMouseEvents(Int32, Int32)
I am guessing that this error has to do with line 13 of test script: `_jumpAfterTest.JAT ();`
How would I fix this? Thanks for the help! I am in mobile, by the way.
↧