variable in C#

Okay so very easy question, i want to make a variable in C# to put an object in, but (as i already knew) var doesn’t work, so how do i do this?

I know that in javascript it’s as easy as var ObjectName : Transform ;
But what is it in C#

Transform ObjectName;

You put the type before the name.

Aaah okay thanks :wink:

uhh yea that actually doesn’t work :S
this is my current code:

public class enemyFollowerRayCast : MonoBehaviour {
Transform ObjectName;
}

What do you mean it doesn’t work? You will have to be more specific. If you are wanting it to show up in the inspector, you will have to declare it public.

that code is incorrect like this.
you must have using UnityEngine; at the top otherwise Transform is not known to it as the UnityEngine namespace is not loaded

deleted my post
you guys jumped on it fast :slight_smile:

using UnitEngine; is in the script, so that’s not the problem.
But what is supposed to happen is that i can drag an object in the inspector (the ObjectName slot) but this slot won’t even appear

Dman already answered that.

–Eric