Hi, Can please some one help me? I’m trying something i saw in Unity Live training but is not working in my script and i cant find why.
this is Script1:
using UnityEngine;
using System.Collections;
public class TesrMor : MonoBehaviour {
public static TesrMor tM;
public int n = 5;
public bool mn=false;
void Update()
{
Debug.Log(n);
}
}
and this script2
using UnityEngine;
using System.Collections;
public class testget : MonoBehaviour {
int u=20;
bool q=true;
// Use this for initialization
void Start ()
{
u = TesrMor.tM.n;
}
// Update is called once per frame
void Update ()
{
q=TesrMor.tM.mn;
}
}
all the time give me this error : NullReferenceException: Object reference not set to an instance of an object
testget.Start () (at Assets/Scripts/Player/testget.cs:11) and NullReferenceException: Object reference not set to an instance of an object
testget.Update () (at Assets/Scripts/Player/testget.cs:17)
Can some one help me ??