Author Topic: SetDirty(this)  (Read 2363 times)

schellenberghq

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 31
  • Game Programmer
    • View Profile
    • Blog
SetDirty(this)
« on: January 16, 2014, 01:04:16 PM »
This line, UnityEditor.EditorUtility.SetDirty(this) is being called from some UILabel object, but I have no idea which one, so I can't tell which UILabel is missing.

This happens when I LoadLevel.AsyncAdditive. Essentially I'm async/additive a scene, and than delete the root of the previous scene.

If I comment out the SetDirty(this) line, things go smoothly and no errors. However, I'm sure that line is there for a reason.
Instead of commenting it out, should I just add a null check?

The Error Message:
  1. MissingReferenceException: The object of type 'UILabel' has been destroyed but you are still trying to access it.
  2. Your script should either check if it is null or you should not destroy the object.
  3. UIWidget.MarkAsChanged () (at Assets/NGUI/Examples/Scripts/Internal/UIWidget.cs:552)
  4. UILabel.MarkAsChanged () (at Assets/NGUI/Examples/Scripts/UI/UILabel.cs:900)
  5. UnityEngine.Font.InvokeFontTextureRebuildCallback_Internal ()
  6. UnityEngine.Font:RequestCharactersInTexture(String, Int32, FontStyle)
  7. NGUIText:WrapText(Font, String, String&) (at Assets/NGUI/Examples/Scripts/Internal/NGUIText.cs:357)
  8. UILabel:ProcessText(Boolean) (at Assets/NGUI/Examples/Scripts/UI/UILabel.cs:950)
  9. UILabel:ProcessText() (at Assets/NGUI/Examples/Scripts/UI/UILabel.cs:907)
  10. UILabel:ProcessAndRequest() (at Assets/NGUI/Examples/Scripts/UI/UILabel.cs:423)
  11. UILabel:set_trueTypeFont(Font) (at Assets/NGUI/Examples/Scripts/UI/UILabel.cs:191)
  12. UILabel:OnValidate() (at Assets/NGUI/Examples/Scripts/UI/UILabel.cs:449)
  13.  

The Line comes from UIWidget:
  1. public virtual void MarkAsChanged ()
  2.         {
  3.                 mChanged = true;
  4. #if UNITY_EDITOR
  5.                                 UnityEditor.EditorUtility.SetDirty(this);
  6. #endif
---------------------------
Jacob S.
Game Programmer
---------------------------

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: SetDirty(this)
« Reply #1 on: January 16, 2014, 10:34:04 PM »
Sure, a null check will work. It seems some label was destroyed, but there is still a dynamic font referencing it, implying its OnDisable/OnDestroy function was not called (?).