Search Unity

Why is it that whenever my enemy prefab is cloned it loses one of the scripts?

Discussion in 'Prefabs' started by SizzlinSam, Mar 16, 2019.

  1. SizzlinSam

    SizzlinSam

    Joined:
    Sep 27, 2018
    Posts:
    2
    Hello. I am trying to make a zombie styled game. I am currently making the respawn system. I have it setup so that the first zombie will follow you, but when you kill it, it loses the script telling it to follow you. So I have to put the script on and drag the target in and tell it what to do every time I kill it basically. If anyone knows how I could do this or if there was a thread I missed please tell me know.
    P.S. I have seen a couple posts like this, but they are in Java I think and I am coding in C#.
     
  2. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    It's impossible to say what's going on from your description alone.

    Are you destroying an object when the zombie is killed? Are you making sure to destroy the GameObject and not the component? Are you making sure to destroy the clone and not something on the original Prefab Asset you're making the clones from?