Search Unity

Can't put gameobject into prefab

Discussion in 'Prefabs' started by JustJay277731, May 15, 2020.

  1. JustJay277731

    JustJay277731

    Joined:
    Apr 22, 2020
    Posts:
    2
    Can anyone give me solutions for this problem, I have a target gameObject that i need so that the enemy follows the player. When i try to put the player gameobject in the target slot it wont allow me to. How can I instantiate gameobjects with the target gameobject still attached.

    ps. sorry if my english is not that good.
     
  2. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    Prefab Assets cannot reference objects in the scene. You'll need to have some script assign the reference to the player when you instantiate the enemy Prefab.