OnTriggerEnter on prefab

[edit] This was not a OnTriggerEnter issue. I cannot change the title

I have a simple zombie gameobject that I have made into a prefab. I would like several on screen. My first zombie I place works great. When I add a second to the scene it does not work. My zombie script does not have any public or serializedfield variables.
OnTriggerEnter works for only the first placed zombie but not any more.

Hi,
I doubt the prefab is the issue here. Most likely you got something in your script wrong.
When you say OnTriggerEnter, you mean an OnTriggerEnter in your zombie?

Can you share some code so that we can see what the problem might be.

Thanks for helping :slight_smile:
Oh, the box collider which is set to trigger is placed on the zombie parent that has the script component

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ZombieRaiser : MonoBehaviour
{
    bool playerInZone;
    bool zombieUp;
    bool zombieDown;
    Transform lookAt;
    Animator animator;

    // Start is called before the first frame update
    void Start()
    {
        animator = GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {
        if (zombieUp)
        {
            animator.SetBool("triggerzombie", true);
        }
        if (zombieDown)
        {
            animator.SetBool("triggerzombie", false);
        }
        if (playerInZone)
        {
            gameObject.transform.LookAt(lookAt.gameObject.transform);
        }
    }

    void RaiseZombie()
    {
        zombieUp = true;
        zombieDown = false;
    }

    void LowerZombie()
    {
        zombieDown = true;
        zombieUp = false;
    }

    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Player"))
        {
            RaiseZombie();
            Debug.Log("Zombie found");
        }
    }

    private void OnTriggerStay(Collider other)
    {
        if (other.CompareTag("Player"))
        {
            playerInZone = true;
            lookAt = other.gameObject.transform;
        }
    }

    private void OnTriggerExit(Collider other)
    {
        if (other.CompareTag("Player"))
        {
            playerInZone = false;
        }
    }
}

In fact the second zombie prefab is being placed in the same place as the first. This might actually be because I’ve keyframed the animation and it’s remembered the same place in world coordinates!

I see I can animate a child gameobject to animate in local coordinates. At the moment my zombies are WAY in the sky even though I’ve reset all the values to zero. I think this might mean I have to start again.

Yes well animation has to be in local space in order for you to move it it around, as it the case usually with character animations etc. It might be better idea to create animation some 3D app like Blender.