I have been learning how to use Instantiate, but I have something that I am confused about. All of the examples I have found have used a Transform for the object argument. However, the documentation says that the argument takes an Object.
From what I understand, Transform is a part of an Object. If that is true, why am I able to create an entire Object from just its Transform?
EDIT: As Dave said, there may simply be an overloaded version of the function. I completely misunderstood what you were asking. Figured I would leave my code here just in case anyone wants to take the long way to do it.
Instantiate returns whatever you pass to it - but it’s contained in an object variable. If you pass it a Transform you get back a Transform in an object variable and you can cast it using Instantiate(something, somewhere, someRotation) as Transform. But if you pass in a GameObject then you get back a GameObject stored in an Object and you must cast that to GameObject. Likewise any other type.
They aren’t overloaded functions - it takes the type of the variable the prefab is and returns that that type - Object is just the ultimate base class of everything that Instantiate can create.