- Home /
Public Transform Is Not Showing Up?
I am trying to get a transform to be created and this is my code but the transform isn't showing up in the inspector but the textures are.
#pragma strict
var grass : Texture;
var stone : Texture;
var block : Transform;
function Start ()
{
if (transform.position.y == 1)
{
Instantiate (block, Vector3(0,-1,0), Vector3(0,0,0));
}
}
Answer by zombience · Oct 18, 2013 at 09:01 PM
Original Answer:
You need to instantiate a GameObject, not a transform. Transforms cannot exist without a GameObject
Updated Answer:
a transform's rotation is stored as a quaternion, not a Vector3.
You can set a transform's rotation from a vector3 like this:
myRotation : Vector3 = Vector3.up;
transform.rotation = Quaternion.Euler(myRotation);
Thanks for your answer but it was actually the rotation couldn't be set as a Vector3
you didn't say anything about rotation. you said the transform would not show up.
Also, if you wish for further clarification on answers or need more help, post comments, not new answers to the question
I know i said it was the transform but that is because the transform wasn't showing and the reason that the transform wasn't showing was because of the error
what is the error? you also didn't mention anything about an error.
Your answer
Follow this Question
Related Questions
clamp limit variables trouble 1 Answer
Renderer on object disabled after level reload 1 Answer
Best Way to make a character move 1 Answer
How to make the player turn left or right only in desired places o edges and not everywhere ???? 0 Answers
Semi-Quick question about "LookAt" script after respawn. 1 Answer