Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

How to instantiate a viariable on a script attatched to a prefab prior to runtime using the Unity IDE

$
0
0
Hello everyone, thank you in advance for your assistance. So, I have a prefab for an enemy which has a script that makes the enemies chase the player. The variable for the transform for the player is in the script, and normally I can just drag the player object onto the black transform slot in the script; however, since it is on a prefab, Unity does not appear to let me drag it into the slot. When I apply the script directly to an enemy (skipping the prefab) then I can drag the player into the missing transform variable. When I try to apply it to the prefab, it won't let me instantiate the variable with the drag and drop system and when I click the circle to the right I have no assets to choose from. What am I doing wrong? Thank you.

Viewing all articles
Browse latest Browse all 171066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>