In this code bellow i am trying to use the sn.die_ally(); function. somehow it works in the start function but does not work in any of the others. I dont know what to google to find the answer because i am a newbie
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class die : MonoBehaviour
{
public void Start()
{
diie_ally sn = gameObject.GetComponent<diie_ally>();
sn.die_ally();
}
public void Update()
{
sn.die_ally();
}
public void OnTriggerStay2D(Collider2D collision)
{
if (collision.gameObject.tag == "Enemy")
{
Destroy(gameObject);
}
if (collision.gameObject.tag == "Ally")
{
Debug.Log("Player nuddade en Ally");
sn.die_ally();
}
}
}
[ICODE]
[/ICODE]