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
4
Question by Curyous · Jan 14, 2014 at 05:55 PM · cameraframerateframeredraw

How do you stop the camera redrawing the frame when nothing has moved?

If nothing in the visible scene has changed, I want to save computing power by not redrawing the frame, so that the last one continues to be displayed.

I can set up a bool to let me know when something has changed in the visible scene.

bool visibleSceneHasChanged;

It seems like Camera.OnPreRender() would be a good place to use this to tell the camera "don't draw this frame, just carry on to the next Update() cycle", but how do I do that? Should I do something in Camera.OnPreCull() instead?

Comment
Add comment · Show 5
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 woodoo · Jan 14, 2014 at 05:59 PM 1
Share

Rarely you would need this kinda stuff, at least, what game is so boring that nothing changes in a frame transition?

avatar image Pangamini · Jan 14, 2014 at 06:56 PM 1
Share

I'd suggest you disable the camera, and call Render() on it manually at the end of frame only when you have moved something. Use some boolean for it. Like:

If something moves, it sets flag to true Camera script checks this boolean, renders if true and resets it.

avatar image pixxelbob · Oct 25, 2016 at 03:37 PM 0
Share

Did you ever find a solution? I'm building an app as apposed to a game and it's wasteful to redraw UI components every frame when nothing has changed.

avatar image Pangamini pixxelbob · Oct 25, 2016 at 03:43 PM 0
Share

I don't know about any builtin solution. Just disable your camera, have some custom dirty flag for it - when you do some visual change, call the Render on camera, or, if you want to stay in sync with other cameras and/or batch multiple changes to the single redraw, use the flag - set the flag dirty on change; then, at the end of the frame, redraw the camera if flag is set

avatar image hexagonius · Oct 25, 2016 at 04:17 PM 0
Share

The example on this API page makes use of the Render method of a camera when its turned off to show how to manually render with a camera:

https://docs.unity3d.com/ScriptReference/Camera.Render.html

The docs are not particularly clear about OnPreRender and if it is also called of the camera is off, but you could just test that.

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

22 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

Related Questions

How to Check if my Score is Divisible by 10 for More than 1 Frame? 2 Answers

vBlank Drift - Locking unity to the vBlank? 1 Answer

is there a way i can make a game object destroy itself pixel by pixel frame by frame 1 Answer

Camera performance issue 0 Answers

render unity camera's frame buffer on to an external application 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