Using the Math class and the x/y/z coordinates of models.

I'm working in C# in Unity3D. I want to be able to use the Math class and the functions it has , particularly the absolute value function/Math.Abs , but when I try to import the Math class by typing: "using System.Math" it does not work and says that 'System.Math' is not a namespace.

Another issue I am having is keeping track of the coordinates of the player and the enemy models on screen. I come from an ActionScript background so normally I would simply be able to use "this.x" "objectName.x" and similar pieces of code. However, this doesn't appear to be the same for C#/Unity. Is there a way to directly access the coordinates of an object? I tried using this.x, gameObject.position.x, but that doesn't work.

Thanks.

Interestingly, this works with JS:

import System.Math;
print (Abs(-5));

However, you don't actually need to import anything to use it, that just makes it more convenient. This works in JS and C#:

print (System.Math.Abs(-5));

You can always just use Unity's Mathf class, though there are some things in System.Math that aren't in Mathf, and also I don't consider Mathf.Sign to have the correct behavior, and prefer to use System.Math.Sign instead.

transform.position.x Have you looked at the scripting reference at all? It's very helpful: http://unity3d.com/support/documentation/ScriptReference/index.html

Use Mathf.Abs