Thanks for the reference but I am aware of this. What I am looking for is a more in depth of what is going on in the above declaration. Especially in shop talk in OOP.
To further my understanding of shortcuts, I took a portion from the scripting documentation as shown below:
The call GetComponent() returns a component attached to the GameObject that returns the contents of the variable in this case the variable transform.
So instead of using GetComponent(), I can use the “shortcuts” or the simple member variables… Interesting!?
Finally the transform variable is an instantiation of the class Transform of some type (class) which I do not yet know the type… I’ll let this one go for now.
My understanding: When writing a script lets say, where the script is embedded in a Game Object, then the transform variable, the instantiated variable, owned by the Game Object is the same as used in the example LevelAttributes.js file.
Hmm, you’re losing me here. Its type is Transform. Its class is Transform. Unless you mean something different?
You’d think so, and so would I, but from what I’ve read it’s actually the other way around. .transform is a property which calls GetComponent(). In practice, not a much different.
Debug.Log(gameObject.transform);
or the equivalent
Debug.Log(transform);
BTW, if you are coming from C++, you might find C# a bit easier to work with than JS/UnityScript. Worth a look anyway.
pakfront: Are you an employee at UNITY? If so, could we have a new section besides scripting where this could be titled as “Unity debugging practices”. The reason why I am requesting this is because I cannot find much on debugging Unity.
“transform” is a field on the GameObject and Component classes that is of the type Transform. Like this:
//C#
public class GameObject
{
public Transform transform;
}
//UnityScript
class GameObject
{
var transform : Transform;
}
The scripting board is fine; the vast majority of threads on the scripting board are already for debugging.
And honestly, there isn’t much to debugging Unity; it’s just general debugging skills you’d develop in any programming language and environment. And like all debugging, it’s imperative that you have some knowledge of the library/environment you are debugging for.
What might be worthwhile though is having some sticky/guide with explanations/fixes for some of the most common errors. If only to save some of us our sanity.
Thanks for the info… My background is C++ so I’ll be using C# mainly because of their similarities.
I agree but the unity documentation is lacking some what but the tutorials are helping in addition to the documentation. When I do not understand the coding and the documentation, I’ll post here at the forum to further help me… This is my sticky…