- Home /
Question by
tolgaguducu · Aug 12, 2015 at 04:21 AM ·
erroractivate
Can't Activate a GameObject Because of a Clon Enemy
i want to activate a gameobject when my player hits an enemy. i can activate my gameobject when my player hits the original enemy. but i cant activate my gameobject if my player hits the clon enemy. there is an error and stops the game when i hit the clon enemy with same script. how can i fix it? thanks for answering.
Comment
Answer by sparkzbarca · Aug 12, 2015 at 04:24 AM
if your searching for a gameobject via gameobject.name or for the comparison you'll need to strip the clone bit off the end after instantiate.
doing something like
GameObject Temp;
Temp = Instantiate(Prefab) as gameObject;
Temp.name = Prefab.name;
will strip it of the clone designation.
Your answer
![](https://koobas.hobune.stream/wayback/20220611235453im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
A bunch of errors that I can't fix 1 Answer
Setting things up for android 1 Answer