Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by malkere · Jan 13, 2015 at 02:07 PM · uibugcanvasrecttransform

4.6 UI Canvas moves on Play, but not really?

I have a lot of canvases and child canvases and it's all going great.

Once in a while, and now again on a new group I'm working on, the canvas likes to reposition itself whenever I press play.

The inspector shows it's anchored position is still at 0,0, and if I change either of those numbers say to 1, it will jump back down to where it's supposed to be. It's almost like it's sticking the Bottom-Left corner into the center pixel by accident, but only on the first pass. I anchor almost all of my canvases in the Bottom-Left. I can also disable and re-enable the canvas and it will redraw itself properly.

I am using EventSystems and UI code quite a bit, but nothing is yet targetting this canvas, other than a parent script storing it as a GameObject for SetActive(true/false), which is going on with many other canvases just fine.

Seems like a bug, like I say loading the Bottom-Left anchor in the Middle by accident, but only for the first run, though it is not a perfect fit. If I hack some code in that changes any of the anchor data it will re-look at it and fix itself... but why?

alt text

That black corner in the middle of the screen should be another 300px left, and 200px down...?

pic.jpg (45.4 kB)
Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image SnStarr · Jan 13, 2015 at 02:15 PM 0
Share

I havent used the new UI system much but from what I gather, you only need one canvas for all your UI elements and you just Instantiate prefabs of the Images, Texts, Scrollbars, whatever when you need them, or disable/enable them from showing on screen when you need them? If I am wrong, let me know.

avatar image malkere · Jan 14, 2015 at 03:50 AM 0
Share

There's no "need" persay for it. I have lot's of windows within windows though... I've only been using the new UI stuff a week or two now, so I'm certainly no expert. I suppose I could be using empty transforms just as easily for a lot of stuff... but for example

$$anonymous$$ainUI(canvas)

-PlayerUI(canvas)

-ChatUI(canvas)

etc. In this case I have the $$anonymous$$ainUI which scales to fit the players screen and controls everything beneath it with that. A child of that, PlayerInfo is anchored in the top left with the player name/etc (can see in the pic) and has its raycasting disabled, so it will always be clicked through/non-interactable. reversely the ChatUI has its raycaster enabled so that the player can interact with it. Both however have their own separate anchors beneath the $$anonymous$$ainUI anchor off which their individual buttons/etc are anchored.

I don't know if it's necessarily proper, but it's working for me.

As a little update, I noticed while working on my laptop: the window drew up and to the right again, but I decided to ignore it and just try the new button I made. But, the new button wasn't where it was being drawn (offset like in the picture above). Somehow only the draw is being offset, the code/script all knows that that's not where it really is. Once I off/on'd the canvas to get it to redraw, I could use the buttons fine in their proper location.... weird, but again, work-around is not hard. Just surely not intended.

avatar image DCTShinobi · Jan 30, 2015 at 07:11 AM 0
Share

Just curious, the canvas that is jumping around, what is its Render $$anonymous$$ode set to?

I really only work with canvases set to use Screen Space- Overlay, which usually works. But it seems like when I first started, my canvas was having issues also. Creating a new canvas/project seemed to make things work for me, but it may not be the same issue. Did you try to create a new canvas and move all of its children over?

avatar image malkere · Jan 30, 2015 at 03:50 PM 0
Share

After SnStarr's comment I started using more RectTransforms ins$$anonymous$$d of new canvases to control the locations of child elements and I haven't been having the problem since.

Like you suggest though recreating it did seem to fix the issue sometimes back when I was running into it.

It was mostly strange because it would on mess up the first update. As soon as you moved the UI or something interacted with it it would realize it's own mistake and fix....

But in truth I haven't seen it since new years...

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

27 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Different Normal vs Debug Mode values in Inspector. RectTransform bug may be? 0 Answers

Unity Android Screen Glitch 1 Answer

Problem moving a panel UI 0 Answers

Canvas lines showing at run time 2 Answers

Transform to RectTransform Conversion 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges