Search Unity

Inspector stuck in play mode as if it would be locked, even though not locked

Discussion in 'Editor & General Support' started by JeffersonTD, Jan 24, 2020.

  1. JeffersonTD

    JeffersonTD

    Joined:
    Feb 5, 2013
    Posts:
    268
    The title explains it. In the past few days it has happened often, that when I'm in play mode and change the targeted gameobject in hierarchy the inspector doesn't change its contents. So the behaviour is the same as it would be if I had the inspector window locked, but it's not locked. The only way to make the inspector change to the correct object is to switch to debug mode or switch out from debug mode.

    Any one else having encountered this? What could be the reason? Unity version is 2018.4.12f1.
     
    zirth66 and stonstad like this.
  2. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    Yes, I am encountering it several times a day. It exists in all versions of Unity 2019.x. I hoped Unity 2019.3.x with its updated UI would fix it and it most certainly does not.

    The challenge is sending the Unity devs a repro. I can't because it happens in 1/100 inspector views. Totally not repeatable, but if you use Unity all day you'll hit it several times and curse the Unity devs.

    If they build their own game and it is sufficiently complex, surely they would then run into this behavior.

    Here is a screenshot of the broken behavior. A node is selected but the inspector is empty. No associated errors are reported to the editor and the inspector is unlocked.

     
    Last edited: Feb 13, 2020
    zirth66 likes this.
  3. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    I submitted a bug report using the screenshot above. Since it is *hard* to repro my hopes are not high.
     
    zirth66 and JeffersonTD like this.
  4. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    Hi,

    Thank you for reporting this issue, I also read the forum thread. I understand your complains towards the editor, however as you stated it is happening randomly and there isn't a constant repro which could pinpoint the issue for the developers when they would be fixing this issue. I personally never experienced this behavior while testing user cases nor developing my own projects.


    I will be closing this case and would like to really ask you to remember or write down the next times when this issue would happen because for each issue exist a cause and I would really like to get more information on this one as it is one of those rare ones.

    If you'll have mroe information for this case please respond to it or you can create a new one.


    Best wishes,
    Tomas Anavičius
    Customer QA Team
     
  5. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    @ Unity Developers, @JoshPeterson --

    I thought I might repo this with a script to blast the inspector through hundreds of game objects per second.

    Code (CSharp):
    1. public class InspectorBug : MonoBehaviour
    2.     {
    3.         private List<Transform> _Transforms = new List<Transform>();
    4.  
    5.         private void OnEnable()
    6.         {
    7.             _Transforms.Clear();
    8.             GameObject[] gameObjects = SceneManager.GetActiveScene().GetRootGameObjects();
    9.             foreach (GameObject gameObject in gameObjects)
    10.                 _Transforms.AddRange(gameObject.GetComponentsInChildren<Transform>());
    11.         }
    12.  
    13.         private void Update()
    14.         {
    15.             Transform transform = _Transforms[Random.Range(0, int.MaxValue) % _Transforms.Count];
    16.             Selection.activeObject = transform.gameObject;
    17.         }
    18.     }
    No luck. I scaled out to ten script instances and did random things in my game, such as scene loads, minimize/maximize UI, and window resizes. I came back empty handed.

    For this reason I am thinking it is not a race condition in the code operating at and below Selection.activeGameObject. The race condition exists above this code in the call stack, likely somewhere in UI logic relating to what happens when a game object is selected in the hierarchy via user action. I don't have Unity source but I would expect to see a check in UI logic similar to...

    if HierarchySelectedGameObject != CurrentHierarchySelectedGameObject
    UpdateInspectorWindow()

    And then somehow one of the above variables is not changing as expected. The work-around is to switch the inspector from Normal to Debug -- so we know there is a code path that bypasses the bugged path.

    Switching the inspector from normal to debug is required each time a new game object is selected, suggesting that the problem lies with logic failing to update the inspector window as needed when hierarchy selection changes.
     
  6. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    Update from QA w/ response....

     
  7. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
  8. JeffersonTD

    JeffersonTD

    Joined:
    Feb 5, 2013
    Posts:
    268
    Unfortunately I don't have clear repro steps either. Luckily it doesn't happen very often, but when it happens it's really annoying. It might be related to having the play mode on for some time, or possibly related to modifying some prefabs, but I haven't really been able to connect it to anything specific I've been doing as it has happened in seemingly different situations.
     
  9. lucvw_1975

    lucvw_1975

    Joined:
    Dec 7, 2014
    Posts:
    20
    I have the issue also, it's really annoying. Restarting Unity seems the only way to make the inspector behave like it should. I'm using 2019.3.3f1. Also no idea how to reproduce this error...
     
  10. JeffersonTD

    JeffersonTD

    Joined:
    Feb 5, 2013
    Posts:
    268
    What you describe sounds more severe. I think for me stopping and restarting the game has always sufficed. But that's also very annoying, when it happens.
     
  11. daraOke

    daraOke

    Joined:
    May 8, 2015
    Posts:
    9
    So, this is happening to me too... Did anyone here find out why?
     
  12. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    No. At least the case is still open, however. I'll forward this to the person handling the case. Which version of Unity @daraOke?
     
  13. pumpkinszwan

    pumpkinszwan

    Joined:
    Feb 6, 2014
    Posts:
    214
    This is happening to me and it is infuriating. I keep dragging components onto the wrong gameobject and causing myself endless headaches.

    In my case entering play mode and selecting an item in the Hierarchy, then exiting play mode will switch the Inspector to the selected item, but the Inspector still won't change to another object when selected - it just gets stuck on whatever was selected in play mode.

    I'm using 2019.3.11f1. Restarting Unity temporarily fixes the issue, but I can't reproduce it reliably.
     
  14. pumpkinszwan

    pumpkinszwan

    Joined:
    Feb 6, 2014
    Posts:
    214
    I have noticed that this might only happen when editing a prefab. It's hard to tell because it's not always obvious when the bug manifested, as you can keep on using Unity without noticing it's happening.

    It could be a coincidence, but I have not had any issues with the bug all day, then suddenly have had to restart Unity a few times to resolve this bug wile editing a prefab (and I was also editing prefabs yesterday when I had a lot of issues with the bug). I haven't been able to reproduce it on purpose, however.

    Another possibility is that I've noticed when I've had trouble with this bug I've had two instances of Unity open (different projects), but I can't be sure if that has always been the case.

    Hopefully this information can help narrow down the problem.
     
  15. lucvw_1975

    lucvw_1975

    Joined:
    Dec 7, 2014
    Posts:
    20
    I don't think it is limited to editing prefabs (although I'm not sure). It might occur when multiple instances of Unity are open (although I'm again not sure). It is, like you said, a very annoying bug and hard / impossible to reproduce. I hope that the bug is solved in Unity 2020... I wonder if this problem is already reported as a bug ?
     
  16. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    Happens when prefabs are not edited. (Case 1219467) Unity Inspector Bugged - Does Not Update
     
    lucvw_1975 likes this.
  17. MarkHenryC

    MarkHenryC

    Joined:
    Nov 30, 2009
    Posts:
    67
    Just happened to me with 2019.4.0f1. Tried changing scenes, changing inspector mode to debug, locking & unlocking inspector etc, but restarting Unity the only fix. I didn't edit prefabs. Only one Unity instance. I have been noticing regular internal Editor UI errors with this version, so things are probably sometimes left in an unknown state.
     
  18. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    Recent update from QA:


    I'm still seeing this with 2019.4 -- anyone else?
     
    Last edited: Sep 3, 2020
  19. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    This is still an issue in 2020.1. The screenshot below shows an inspector that refuses to show any properties for a game object. I see that two rows are highlighted -- maybe this isn't a bug?

     
    Last edited: Sep 3, 2020
  20. RealityDotStop

    RealityDotStop

    Joined:
    Mar 4, 2013
    Posts:
    42
    Definitely a persistent issue in the 2019 cycle. Still getting it in 2019.4.8f1, with no errors in console. Fortunately, a debug/normal toggle will persuade it to change the displayed object.
     
  21. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    Still trying to resolve this behavior. How about a brief survey:

    Are you using Cinemachine? (I ask because it adds icons to the hierarchy.)
    Are you adding custom inspectors (i.e. [ContextMenu("Foo")]?

    Just trying to see what we might have in common that isn't being recreated in Unity testing.

    @Tautvydas-Zilys @JoshPeterson How likely is it that I could get a source license to troubleshoot this issue when it randomly happens? I'm confident it is a race condition because it happens randomly.
     
  22. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    Reproduction steps submitted to Unity:


    1) Enable "recompilation after finished playing". Edit -> Preferences -> General -> Recompile after finished playing -> true.

    2) Open the sample project. Hit play.

    3) In the hierarchy, observe that you can select Inspector Item 1 ("Foo") and Inspector Item 2 ("Bar"). The inspector updates.

    4) Edit Foo.cs and make a code change. i.e. Change the value of Foo1 to 5. Save file changes.

    5) The inspector is now frozen. The inspector will not open for other game objects and it will not work until playback stops. Any code change, including insertion of white space causes this behavior.
     
  23. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    This may be fixed in 2020.1.7. Editor: Fixed inspectors not updated when using 'Recompile After Finished Playing. (1196494)
     
  24. support3Dswipe

    support3Dswipe

    Joined:
    Sep 16, 2014
    Posts:
    3
    I have also the issue.
    I deleted the tab and created a new one.
    Seems to be working...
     
  25. pumpkinszwan

    pumpkinszwan

    Joined:
    Feb 6, 2014
    Posts:
    214
    It's still happening to me in 2020.1.14f1, and has been happening in every version for quite some time.

    Very annoying and productivity ruining bug.
     
  26. CloudyVR

    CloudyVR

    Joined:
    Mar 26, 2017
    Posts:
    715
    As my scenes are becoming more complex the bug is happening with higher frequency. Now my inspector is becoming pseudo-locked maybe 20 to 50 times each day.

    Thankfully there is a workaround that is simple,

    not realizing the inspector is locked often causes me to edit the wrong objects, which on occasion this bug leads to my entire scene becoming corrupt or lost work.
     
    Last edited: Aug 6, 2022
  27. Armegalo

    Armegalo

    Joined:
    May 14, 2018
    Posts:
    30
    Well this just happened to me in 2021.3 !! The workaround still works though :)