Author Topic: Forcing Objects to Left Side Of Screen?  (Read 4042 times)

jaz1974

  • Guest
Forcing Objects to Left Side Of Screen?
« on: December 09, 2013, 08:16:21 AM »
Hey there,

Is there a way of forcing a Panel to the left side of the screen (so its completely against the edge).

I'm hoping I can make this happen, so that no matter what screen resolution the player is using, my Panel is always locked to the left side of the screen.
At the moment, when I set up my object so that it's hard left in a particular screen resolution, when I switch to another it moves inward.

I'm using the newest version, using the Anchor system which is part of the Panel component now.

I'm setting the targetobject to be UIRoot.

Not sure what I'm doing wrong, but adjusting the offset parameters has no affect on anything.

Also, I noticed in the latest youtube video there is a 'Hide If Off Screen' check box.   I'm not seeing this - does that mean I don't have the latest version.  I just downloaded the one I have from the Unity Asset Store.

Thanks!

Jaz

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Forcing Objects to Left Side Of Screen?
« Reply #1 on: December 09, 2013, 01:42:35 PM »
Hide if offscreen checkbox only shows when you are anchoring to a game object, and won't show if you're anchoring to something that has dimensions (widget or panel).

To anchor a panel to the left side, set its left and right anchors with the origin of "Target's Left".

Ferazel

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 150
    • View Profile
Re: Forcing Objects to Left Side Of Screen?
« Reply #2 on: December 09, 2013, 02:23:27 PM »
I'm also having a problem doing some tests with 3.0.7. It appears when I try to parent my anchor of a sprite to my UIRoot in order to anchor the sprite in the upper-left portion of the screen for example, I am running into problems that your video doesn't appear to follow along with.

When I try to anchor to my UIRoot it thinks that it is a GameObject and it will not allow me to specify any of the drop lists and will only allow me to offset from the GameObject's Vector3 position.

In the video it appears that the drop lists should be enabled when you parent to the root, but in my case they are not.

GameObject Hierachy:
UIRoot
--UICamera
----UIPanel
------UISprite(w/ Anchor)
--------UISprite
--------UILabel


Is this still the preferred 2D GameObject hierarchy for 2D objects?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Forcing Objects to Left Side Of Screen?
« Reply #3 on: December 09, 2013, 04:21:52 PM »
My UIRoot has a panel on it. It's the new 3.0.7 hierarchy that doesn't use UIPanel and UIAnchor game objects, and where all sprites are directly under UIRoot.

Only panels and widgets derive from UIRect and can be used. All others are treated as game objects.

jaz1974

  • Guest
Re: Forcing Objects to Left Side Of Screen?
« Reply #4 on: December 09, 2013, 04:50:04 PM »
It might be worth defining the prerequisites for the new anchor system.
I.e. what exactly is needs in order for it to function correctly.
Otherwise lots of people may keep asking the same question.