Hello,
I need to get access to an instantiated prefab that contains a rigidbody to add some force to it in c#.
// Script 1 Instantiates it ...
void Start()
{
GameObject fireBall = Instantiate( "FireBall", newVector3( 0, 0, 0), Quaternion.identity, 0 );
}
// Script 2 needs to access it ...
Rigidbody fireBallRigidBody = (Rigidbody)GetComponent<Rigidbody>();
if(fireBallRigidBody == null)
{
Debug.Log ("fireBallRigidBody is null ");
}
Pretty simply I use to think but the rigidbody continues to be null and I’m apparently rusty …
I’ve done this before but drawing a blank and can’t seem to find a good example.
Hint?
Thanks