Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 bsawyer · Sep 19, 2017 at 08:52 PM · uiscenerecttransformdirty

RectTransforms constantly being modified in Edit mode, marking scene dirty

We have a scene with nothing but a Canvas object and a bunch of children, representing our app's different menu screens. For some reason when we have this scene open in the Editor, it is continuously being shown as dirty as though something has changed, even if the developer hasn't made any changes to the scene. And if you save the scene's "changes", diffs actually show up in version control (we have asset serialization set to Force Text, so it's possible to view, albeit not necessarily understand, the underlying YAML). Apparently what's constantly changing are various RectTransform values - size deltas, positions, anchors, and so on. Due to how convoluted the YAML is it's near impossible to tell specifically which RectTransforms are changing. Regardless, this is a real pain point for our team since not only is it frustrating having constant prompts about unsaved changes, but when actual changes are made, we have to try and separate the "real" changes with the erroneous ones in our git commits.

I've tried searching through our solution for any uses of EditorUtility.SetDirty as well as any uses of Undo and the few that exist are not even a part of this scene. I've tried disabling upper-level RectTransforms in the scene to try and narrow down the offender(s) but it feels like I'm getting inconsistent results. I want to believe there's something simple in the scene hierarchy causing this, though I can't find any similar cases through Googling my issue. Does anybody have suggestions for what to look for that I haven't already tried? Or is this perhaps a Unity bug that I should report?

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

1 Reply

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

Answer by FortisVenaliter · Sep 19, 2017 at 10:17 PM

So, I have seen this too, especially when you have a lot of RectTransforms nested in a Canvas.

The problem seems to stem from floating-point precision issues in the hierarchy. This is just conjecture on my part, but I'll try to explain what I think is happening. Basically, each RectTransform stores it's information relative to it's parent, but using the internal values. When viewing it in the inspector, it converts those internal values to friendly values, using it's parent's values to assist. When the inspector values are changed, it saves it back to the markup data files. But, when you have a deeply nested hierarchy, more operations are happening between those steps, and those conversions introduce floating point errors that it sometimes sees as a change, and decides to write them to the files, causing the issue you're seeing.

I've definitely noticed that the issue becomes more pronounced the deeper the RectTransforms nest.

Unfortunately, I don't know of a fix other than trying to reduce the number of levels in your hierarchy. And that's certainly not always possible.

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 bsawyer · Sep 20, 2017 at 01:14 PM 1
Share

That makes sense. I would say our scene in question does have a lot of nested UI components.

We have just the one single root-level Canvas. If I ins$$anonymous$$d set up additional Canvases in the hierarchy as children, grandchildren, etc. could that potentially make a difference, i.e. "simplify" the floating point calculations Unity has to keep doing, by reducing the transform depth of some objects? Or is the complexity of the operations based purely on absolute scene depth, versus "depth from Canvas"?

I mainly ask because I've already been considering adding sub-Canvases since it's supposed to be better for performance anyway, given how meshes are rebuilt and so on.

avatar image FortisVenaliter bsawyer · Sep 21, 2017 at 03:49 PM 0
Share

I couldn't say for sure, but it's worth branching to give it a shot.

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

124 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 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 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 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 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

Unity Editor - Scene view not redrawing 0 Answers

How to make buttons have sound when it is highlighted and clicked? 0 Answers

Strange UI scrollbar handle recttransform behaviour,Cant resize clickable area on UI handle 1 Answer

SVG Image quality when imported to UI is bad. 0 Answers

Is there a way to activate a timer from another scene? 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