Yes but if I create an empty GameObject, and then attach a rigidbody to that object, the game object hasnt become a rigidbody has it? It just has a rigidbody attached to it.
But when you instantiate, the code says you’re instantiating a rigidbody, which you clearly aren’t.
It’s impossible for a Rigidbody component to exist without being attached to a GameObject. So when you instantiate a Rigidbody, you are in fact doing just that, but you can also assume that the GameObject it’s attached to comes along with it. The object that’s returned by Instantiate points to the Rigidbody component, not the GameObject. That’s a special case with Components because of the requirement that they’re attached to a GameObject; for other types such as Texture2D, Material, etc., which aren’t components, what you instantiate is exactly what you get.
i am trying to compare the materials of an instantiated game object and a material that i have referenced in my script.
but while i am executing my code it will never return true to my condition even when i have only one material in my whole project that i am assigned to my prefab and that i have referred to in my script.