- Home /
How to position elements on scene
Hey! I'm making a game and I have a GUI which contains a ScrollView with 16 icons positioned in a grid in 8 columns and 2 rows;
What I need is to add a rotating square texture behind some of these icons, but rotating Texture2D seems not to be working in old GUI system so I decided to try to position 16 textures on the scene and to make ones that i need visible and move it along when the scrollview is being moved.
But I found it hard to understand how to position those textures on scene so that they are placed on the right coordinates and their size is one that i need. Let's say that i want 1 sprite with 100px X 100px size positioned at the (50px,50px) coordinates of my screen.
In OnGUI I can use something like this
GUI.DrawTexture(new Rect(50,50,100,100), myTexture);
Or (which is much better for me):
GUI.DrawTexture(new Rect(Screen.width/10,Screen.with/5,Screen.width/10,Screen.width/10);
Thats are just the example. What I mean is that I can easily define exact screen size and position and I still cant understand how to position sprites 10px away the left border of my device screen.
Help me please, I' m extremely tired of searching for the solution.
Also, when I drag'n'drop my imageon the scene and run the game - only one instance of the image is being rendered - why?