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
2
Question by Eydamson · Mar 09, 2015 at 11:58 PM · unity5optimizationlagoptimizedirty

What is a dirty scene objects?

I was optimizing my code then as I run my game with the profiler I can see what happens when my game is lagging. and I saw that there is this dirty scene object that consumes cpu. Ive been googling it and cant find a clear answer. Anyone can explain this to me and for the benefit of everyone encountering this kind of issue? TIA :)

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

2 Replies

· Add your reply
  • Sort: 
avatar image
4

Answer by Alex Rider · Mar 13, 2015 at 04:12 PM

"Dirty" refers to a scene object that hasn't had its state updated.

“Flag” and “bit” are synonymous in programming — they both mean a single micron of data that can be in one of two states. We call those “true” and “false”, or sometimes “set” and “cleared”. They can be used interchangeably.

When the scene object state changes, we set it. When we need the object’s state, we check the flag. If it’s set, we calculate whatever procedure and then clear the flag. The flag represents, “Is the scene object out of date?” For reasons that aren’t entirely clear, the traditional name for this “out-of-date-ness” is “dirty”. Hence: a dirty flag. “Dirty bit” is an equally common name for this pattern.

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 Digital-Phantom · Mar 13, 2015 at 04:22 PM 1
Share

damn... I was hoping for some innuendo....lol

avatar image Alex Rider · Mar 13, 2015 at 05:51 PM 0
Share

:P This is as clear as it gets!

avatar image TruffelsAndOranges · Jan 29, 2016 at 09:29 AM 0
Share

That explains what a dirty bit is very well. However, what could cause it? I don't know of any states that I am setting that could need "cleaning" but still get >200ms lag spikes cause of it.

avatar image Skunk-Software · Jan 28, 2018 at 08:04 AM 0
Share

Adding some info: I'm still having problems with tracking down a solution for animators.dirtysceneobjects performance. Possible Reason: a lot of animators overlapping, especially with rigidbodies attached.

avatar image
1

Answer by Cherno · Mar 10, 2015 at 01:49 AM

Sounds like EditorUtility.SetDirty; a scene object that is set to dirty keeps any changes made to it after the game stops playing and carries them over into editing mode.

Comment
Add comment · Show 2 · 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 VivienS · Jan 29, 2016 at 10:09 AM 0
Share

Are you sure this is true?

Afaik "SetDirty" only tells Unity that there was a change made in edit mode and it needs to be saved.

If there is a new feature where the "dirty" objects carry information over from running game to edit mode, could you please post a link to the documentation or a code sample? Would be really nice to know!

avatar image VHNGames VivienS · Jun 03, 2020 at 12:59 PM 0
Share

I have faced this situation twice.

A - $$anonymous$$aking an ScriptableObject via editor Button 1 - Create an Editor Button thats create a ScriptableObjeact and change his data informations like variables. 2 - Save this ScriptableObject in assets folder. 3 - I need to make this Scriptable as SetDirty, so the editor could save the data changes after i close de unity and open again.

B - Changing an list values with a editor button.

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

26 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

Related Questions

What are "Dirty Scene Objects" in Animator.Update in the Profiler 4 Answers

Why does this simple follow script make my game lag? 2 Answers

Public, private and getting stuff efficiency question. 2 Answers

How do you optimize your fonts? 1 Answer

Help with optimize code 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