Example - For an Inspector Variable i put these two -
var TargetPlayer : Transform;
var PlayerTarget : GameObject;
What is the Difference between the two?
Example - For an Inspector Variable i put these two -
var TargetPlayer : Transform;
var PlayerTarget : GameObject;
What is the Difference between the two?
Transform deals with things mostly with position in space with the object, while gameobject deals with the textures, audio, particles on the object
Gameobject
Transform
Thank you!
A Transform is a GameObject Component. You can always access a transform’s gameobject or gameobject’s transform, but to keep things clear, I always define the variable as a GameObject and then access its transform if I need to.
By that way of speaking, you can also access a Transform’s transform (but not a Game Object’s gameObject). Transform.gameObject is faster than GameObject.transform, so if you’re going to do one, do the one you say you don’t do. ![]()