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
1
Question by cuchi · Sep 15, 2014 at 03:33 PM · canvasscaleunity 4.6

Unity 4.6 Canvas Dynamic Scale

Hi everyone,

I am really excited about new UI and I am trying lots of things. Now, I am trying to do seamless transition between "scenes". A "scene" is transitioned to, by moving camera around. On nearly every my "scene", there is UI Canvas. These must be in world space render mode (I want them to stay in "scene" after camera moves elsewhere).

I am now using orthographic camera for my 2D game and setting orthographic size according resolution and ratio. Problem is, that I don't know how to scale down canvases to the size of camera. One solution is, that I will dynamically change canvas to "screen space camera", read scaled values, store them, set canvas back to "world space" and apply stored values. Problem is, that I don't know how to access these values.

So the question is: How can I access calculated values inside RectTransform component?

Is there any other way of doing this?

Comment
Add comment · Show 1
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 Zamanis · Sep 15, 2014 at 03:44 PM 0
Share

Try adding Reference resolution in your Canvas. Set you reference resolution and put your Canvas objects where you want. Go to Game and check multiple resolutions.

2 Replies

· Add your reply
  • Sort: 
avatar image
4
Best Answer

Answer by cuchi · Sep 16, 2014 at 08:29 PM

If anyone is interested, I have found a solution to this: If you set canvas to Screen Space - Camera render mode and attach camera to it, then, if you switch it to World Space render mode, calculated values will stay in place, so no extra logic is needed. I can't believe I haven't discovered that earlier :)

Comment
Add comment · Show 4 · Share
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 aman_jha · Oct 13, 2014 at 11:51 PM 0
Share

This is probably the brilliantest thing I've ever seen. You're a flipping genius. If I could give you a cookie, I would.

avatar image hansadler · Nov 27, 2014 at 08:23 AM 0
Share

This is the answer I was searching for, but couldn't find for the longest time because I didn't know what to search for. You're right, it is the brilliantest thing.

avatar image falconer · Dec 15, 2014 at 10:20 AM 0
Share

If anyone is still facing some issue about the same even after doing this, maybe you should try to use the Anchor Points and Canvas Scaler on the Canvas.. Here is an excellent article about the same Canvas Scaler Unity 4.6

avatar image karma0413 · Jan 30, 2015 at 08:36 PM 0
Share

Thanks Falconer, this addressed the SCALER: Scale to screen size, but what I have been stumped for a week on using the "$$anonymous$$eep pixel size" scaler =(

avatar image
0

Answer by gegagome · Jan 20, 2015 at 08:46 AM

Love it!!

I messed up my canvas local scale and this solution even improved my rectTransform AnchoredPos for a panel

Thanks

Comment
Add comment · Share
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

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How to covert a rectTransform scale to world scale? 1 Answer

Can I put non-GUI objects into Canvas? 1 Answer

Layout error after crash has effected canvas scaling 1 Answer

Responsive Canvas - Panel inside not Fitting 0 Answers

Why does my dynamically instantiated UI element have a different scale than the prefab it was instantiated from? 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