- Home /
Question by
Albano.conte · May 27, 2012 at 09:14 PM ·
prefabobject
When my prefabs are instantiated they don't have their script attached
I've got this weird problem. I've made this Shooting Script, when my player click's the button a bullet appears in the game, but the bullet does nothing. I checked the cloned bullet and somehow it doesn't have the script attached, can anyone tell me how to solve this? If I drag it to the Hierarchy panel, it does have the script. I use this to instantiate them:
void Update ()
{
if (Input.GetMouseButtonDown(0))
{
Instantiate (BalaJugador, new Vector3 ( Jugador.transform.position.x,Jugador.transform.position.y,Jugador.transform.position.z), Quaternion.identity);
}
}
Comment
Is the "bullet" a Prefab? Does the prefab have the script attached?
If you drag an instance of the prefab into the "Hierarchy" does the script show up there? How are you instantiating the bullet?
Best Answer
Answer by Albano.conte · May 27, 2012 at 11:53 PM
Solved the problem guys, apparently there was some problem with the script itself. Thanks anyways.