Hi, can I assign a bool from a script and check if its true in another? if so how can I do this. I did this but its not working and it always no matter what I try it pops this error :
nullreferenceexception object reference not set to an instance of an object
Here is the script :
private Hands shot;
private Animator MyAnimator;
public bool Dead;
void Start()
{
shot = GetComponent<Hands>();
MyAnimator = GetComponent<Animator>();
}
void Update()
{
MyAnimator.SetBool("Dead", Dead);
}
public void OnCollisionEnter2D(Collision2D collision)
{
if (collision.gameObject.tag == "Player" && shot.Shot == true)
{
Dead = true;
}
}