- Home /
Instantiated Prefab Trigger not firing.
Hey, I am build a never ending 2d game, when the player hits a trigger on a prefab it spawns in a new prefab at a certain point on the old prefab.
So The player Hits the trigger on the first prefab a new prefab spawns at the end of the first prefab and on and one and one.
But, the first spawn works fine, but once the player hits the next trigger nothing happens, it does not fire.
I have had the code, Delete the old trigger and rename it as well as the tag, But nothing. The new prefab spawns but the player's collider can not set off the new prefabs trigger. I have also attached a rigidbody to the trigger but still nothing works.
The code is very simple
public GameObject land01;
public Transform createPoint;
void OnTriggerEnter (Collider playHit)
{
if(playHit.gameObject.tag == "createPoint")
{
Instantiate(land01, createPoint.position, createPoint.rotation);
Destroy(playHit.gameObject);
print("Hit");
}
}
It works fine without issue, does anyone know why this is not working, I have also looked through other posts with the same issue but to no help. I will continue to do so.
Thanks
Your answer
Follow this Question
Related Questions
Why is instantiated animator prefabs are not working properly? 2 Answers
How to randomly instantiate other prefabs parallel? 1 Answer
Why is my Prefab Instantiating when the Scene is Loaded? 2 Answers
How do i Instantiate a prefab with specific assests included 3 Answers
ID or name for Instantiate prefab 1 Answer