2D Toolkit Forum
2D Toolkit => Support => Topic started by: Arnold on October 11, 2013, 05:37:33 pm
-
Hey!
I'm Arnold and i'm super new to Unity coming from a small Gamemaking tool called Stencyl.
Here's my noob question.
I have my tk2dCamera setup with an child Anchor with the upper Left setting. Attached to the Anchor
i have my GameController Gameobject which sits at 0,0,1 in the Scene (upper left). Now i spawn a prefab (Sprite) via code as a child of the GameController and want to set the Sprite's position. This works but if i set the position of the Sprite to 0,0,1 it gets displayed in the middle of the Screen. My sprite is basically ignoring the tk2d Anchor. I just want to freely position my Sprite with 0,0 being top left, like in the scene view.
What am i doing wrong?
-
Set the sprite.transform.parent = cameraAnchor.transform;
Position the sprite using sprite.localPosition (x, y, z) = 0,0,0 = topleft.
-
aha!
cool so it is a problem between global and relative aka local positions.
Thanks, something learned!