|
Hello, I'm still getting used to the Unity Scripting language. However, I'm learning pretty fast now. I started writing a script for an inventory in my game. It's working quite well. But as it is right now, the buttons for each item have their own position inside the inventory. I need to get it so the buttons position is some type of "float: left". Is this possible? I have them in a GUI Group (the inventory space) so it would work if they float to the top-left of this group. Here's the current code for one of the item buttons:
What I need to get is changing
to something similar to
Thanks for any help! (If you want to see the game so you know what I'm talking about, the newest version is always available at http://www.mythstrott.webs.com/mythstrott.html)
(comments are locked)
|
|
After more searching, I found this: http://unity3d.com/support/documentation/Components/gui-Layout.html I haven't used it yet, but it seems to be the solution. So if anybody else was having this problem, read the link :) Thanks to the 3dDude and spree for trying.
(comments are locked)
|
|
in place of a pixel position you can use something like this :
using this method it well always stay in the top left corner. you just have to change the x and y of the pos var and it should make the gui position change I'm not sure what I am supposed to set x and y to?
Aug 05 '10 at 03:25 AM
MythStrott
If it's in a group the top left position in this group is just 0,0 afaik.
Aug 05 '10 at 09:19 AM
StephanK
well if you set x and y to 2 then it will make the position always be in the center because if you divide something by 2 its half of it. so you can just try different values to get it into the top left corner
Aug 05 '10 at 01:36 PM
3dDude
Ok, well this doesn't solve my problem. Did you read my question? What I have is multiple buttons. Each button is an item. Sometimes the an item is active, sometimes not. I have that scripting done. But my problem is that the buttons for each item have their own position inside the inventory. I need to get it so the buttons go to the top-left position without overlapping Thanks
Aug 05 '10 at 02:37 PM
MythStrott
what do you mean "overLapping"?
Aug 05 '10 at 04:29 PM
3dDude
(comments are locked)
|
|
Read this http://docs.unity3d.com/Documentation/Components/gui-Basics.html it might be helpful for your problem, go to the The Boxes positioned by the above example section.
(comments are locked)
|
