Answer the question
In order to leave comments, you need to log in
Why doesn't DeadZone(Trigger) work?
public class HereDead : MonoBehaviour
{
public GameObject Player;
public GameObject Ragdoll;
void onTriggerEnter(Collider other)
{
if (other.tag == "DeadZone")
{
Player.SetActive(false);
Ragdoll.SetActive(true);
Instantiate(Ragdoll, transform.position, transform.rotation);
}
}
}
Answer the question
In order to leave comments, you need to log in
Isn't it necessary to define Player and Ragdoll ( respectively, in GameObject.Find specify their name on the stage )
public class HereDead : MonoBehaviour
{
public GameObject Player;
public GameObject Ragdoll;
void onTriggerEnter(Collider other)
{
if (other.tag == "DeadZone")
{
Player = GameObject.Find("Player");
Ragdoll = GameObject.Find("Ragdoll");
Player.SetActive(false);
Ragdoll.SetActive(true);
Instantiate(Ragdoll, transform.position, transform.rotation);
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question