-
Notifications
You must be signed in to change notification settings - Fork 3
User Interface
In order to get collected items to easily enter/exit the inventory, utilize the same background fade on UI and world objects, and maintain a consistent pixel size I decided to write my own UI anchors that could be utilized as child objects of the Main Camera.
enum Anchor { topLeft, topCenter, topRight, middleLeft, middleCenter, middleRight, bottomLeft, bottomCenter, bottomRight }
The standard anchor positions that any UI element should be able to achor to
Anchor anchor
place on the screen this element is anchored to
Vector2 offset
offset from the anchor point
bool snapToPixel
when true, causes the element to snap to a pixel-perfect position (usually true)
Called from both Awake and a Set Method. Calculates where the UI element should be.
Check out a Free Demo of the game on my personal website. (Updated Frequently)