- Home /
Question by
jukke · Jun 11, 2011 at 10:33 AM ·
transformgetcomponent
Print current Transform of an instance in the debug log
Why do these lines of code not print the actual position of the instance but only "UnityEngine.Transform"? and how do I get the result I want?
var curTransform = instance.GetComponent(Transform);
Debug.Log(curTransform);
Comment
Best Answer
Answer by Mike 3 · Jun 11, 2011 at 11:51 AM
simply:
Debug.Log(transform.position);
You don't need to use GetComponent with Transform, it's already got transform as a helper property
Your answer

Follow this Question
Related Questions
modifing enemies target inside a radius 1 Answer
How to use "GetComponent" and "transform" code in dll file? 0 Answers
Endless 3D plane repetition animated by script is not moving 0 Answers
Why won’t GetComponent ().rotation.SetLookRotation actually change the object’s rotation? 1 Answer
Getting a huge amount of errors regarding contained definitions in GameObject 1 Answer