When I instantiate enemies, their scripts are not referenced to the player or the death ragdoll. How do I attach these to the clones?
Thanks.
When you call Instantiate(), you are returned the instantiated clone object! You can then refer to that clone to do whatever you want with it.
GameObject clone = Instantiate(enemyPrefab, enemy.position, enemy.rotation);
// do things with clone
Here is the documentation by Unity.
Create GameObject PlayerGameobjectReference
and within OnEnable()
or Start()
method use PlayerGameobjectReference = GameObject.Find('Insert Player Name Here');
You can also find gameobjects by tags/types