Instantiating GUITexture and positioning it

All I want to do is instantiate a GUITexture into my unity world and position it in a c# script. This works just fine:

public GUITexture guiTextureObject;
start(){
Instantiate(guiTextureObject);
}

Now I need to position it inside the script. The best way I know how to do this is:

Instantiate(guiTextureObject,Vector3(.5, .5, 0), Quaternion.identity);

Gives me an error: Expression denotes a ‘type’, where a ‘method group’ was expected

I have also tried this that I have found, but still many errors:

public GUITexture guiTextureObject;
start(){
GameObject go = new GameObject(“guiTextureObject”);
GUITexture guiT = go.AddComponent(GUITexture);
}

Please help! Thank you!

C# needs the “new” keyword. (e.g., new Vector3…) AddComponent returns Component in C# rather than the type like in Unityscript, so you need to cast or use generics. Also, http://forum.unity3d.com/threads/143875-Using-code-tags-properly.

–Eric

Thank you so much! And thank you for showing me the code tags, I was looking for those.:smile: