Inability to access the properties of a clone.

Hello, so recently i began work on a new game. This game includes procedurally generated solar systems. For this to work i need to acess the mass of the cloned star. However as the star’s mass can variy depending on what variant of star it is i came acroos a problem. When it was getting the rigidbody component of the gameobject t was accessing the Prefab default mass (100), not the cloned prefab’s mass (125) . Please help.

-Neo

I’m sure there are several ways to approach this, but it sounds like you are trying to make code that looks something like this:

// At some point you are instantiating from a prefab
Transform clonedStar = Instantiate(sourcePrefabStar); // shortened

// Now you can manipulate the clone
Rigidbody clonedStarRigidbody = clonedStar.GetComponent<Rigidbody>();
float cloneMass = clonedStarRigidbody.mass;