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 guigaCA · Jan 20, 2015 at 02:30 PM · 2dcanvasscreengui-buttongui-window

Screen Space - Camera lag when zooming

Hello, I'm trying to make a GUI using the Canvas tool for a 2D game. The game is supposed to support multiple resolutions, so I figured Screen Space - Camera would be the best option, since it keeps the same format no matter what resolution.

The problem is, when I zoom in or out there is a small delay with the GUI. This doesn't happen when I use Screen Space - Overlay, but I have no idea on how to use it to support different resolutions. I've seen that some people had similar problems, but I didn't find any solutions. Does anyone know how to solve this? Either by making Screen Space - Overlay support many resolutions or stopping the lag on Screen Space - Camera or another solution I might have not been able to think.

The code snippet for the zoom is the following:

 if (Input.GetAxis("Mouse ScrollWheel") > 0){ // forward
                 debugMessage = "mouse foward";
                 newOrthgraphicSize = Mathf.Max(mainCamera.orthographicSize-0.3f, 4);
                 mainCamera.orthographicSize = newOrthgraphicSize;
 }

Thanks in advance!

Comment
Add comment · Show 3
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 KurtGokhan · Jan 20, 2015 at 02:48 PM 0
Share

If you mean changing field of view, clipping distance etc. of camera when you say zoo$$anonymous$$g, it is supposed to delay. If UI kept redrawing for every frame it would lag so UI doesn't redraw every frame but with a delay. However there should be a redraw function for you to call manually if you want.

avatar image guigaCA · Jan 21, 2015 at 12:31 PM 0
Share

I change the camera by changing its orthographic size (I put the code snippet in the question, now). I'll look into this redraw function. What I don't understand is why doe it not lag when I move the camera, only when I zoom it. And also, why does it work with Screen Space - Overlay.

avatar image KurtGokhan · Jan 21, 2015 at 12:50 PM 0
Share

The lag is because when you set the orhographic size of the camera, all transformation matrices are recalculated. You should look for other solutions.

1 Reply

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

Answer by rakkarage · Feb 22, 2015 at 05:08 AM

  1. put the tileMap (or thing you zooming on new layer)

  2. make new camera set to only show that new layer

  3. remove that layer from old camera

  4. change orthographicSize on new camera

fixed. no lag cuz the shit that was lagging back to normal scale is not even being scaled at all anymore

Comment
Add comment · Show 1 · 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 guigaCA · Mar 10, 2015 at 12:42 PM 0
Share

I gave up on the canvas and went another way. I can't test it anymore, but I'll select it as a good answer because it makes sense =)

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

make the canvas fit my game size i want 0 Answers

How do I draw simple shapes? 1 Answer

How does Bounds.Encapsulate() work? 2 Answers

Don't move unless in BoxCollider2D (C#) 1 Answer

Showing random image from folder on my U.I. canvas by script 0 Answers


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