- Home /
"Type" type
How can we use the "Type" type?
Type _type = typeof(int);
//error CS0246: The type or namespace name `Type' could not be found
using System.Type doesn't work.
Comment
What program$$anonymous$$g language is this? Is it JavaScript or C#?
That was C#. It seems that $$anonymous$$onoDevelop doesn't pick up on Type, but it works fine with the System namespace.
Best Answer
Answer by niX_BB · May 16, 2012 at 03:36 PM
You need to include the System namespace, the following C# code should work
using System;
public class myClass : MonoBehaviour
{
void Start ()
{
Type _type = typeof(myClass);
Debug.Log(_type);
}
}
Your answer
Follow this Question
Related Questions
Is there a way to find out what type of collider an object has? 2 Answers
Textfield Not Working - Cannot Select 1 Answer
Simple Shader Syntax ... or so I thought 0 Answers
Generic Component Declaration 1 Answer
if (!(apple is Vege)) then... 1 Answer