Hello everyone, in my game there is a prefab enemy which has an empty object called 'enmshotPos'. Every enemy has this. When an enemy shoots it finds the enmshotPos. The problem here is that EVERY enemy has this and it thus finds one specific one. Is there anyway to make it find enmshotPos in its children so it picks the one it parents and not a random one?
Here is the code it finds enmshotPos in:
var enemybullet = Instantiate(enemybullet,
GameObject.Find("enmshotPos").transform.position,
GameObject.Find("enmshotPos").transform.rotation);
enemybullet.rigidbody.AddForce(enemybullet.transform.forward * force);
rate_time = Time.time + rate;
To anyone reading this: thanks a lot for taking the time to read this and thanks for answering if you do decide to do so.
↧