Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

(Case 1082570) Hidden components treated as removed

Discussion in '2018.3 Beta' started by xeleh, Oct 2, 2018.

  1. xeleh

    xeleh

    Joined:
    Jul 22, 2016
    Posts:
    302
    I was testing v2018.3b3 and just found something weird which happens to be really bad for one of my assets.

    Imagine a simple script like this:
    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. namespace Betatesting {
    4.  
    5. public class Test : MonoBehaviour {
    6.  
    7.     void Reset() {
    8.         hideFlags = HideFlags.HideInInspector;
    9.     }
    10.  
    11.     void Start() {
    12.         Debug.Log("I'm alive!");
    13.     }
    14.  
    15. }
    16.  
    17. }
    If you go and add this Test to a GameObject, it will work as expected: the component will be hidden in the Inspector and the code in Start() will execute just fine.

    But if you go and create a Prefab from this GameObject then:
    1. The Test component will be no longer hidden in the Inspector. It will be "magically" visible again both in the Prefab and the Prefab instance.
    2. If you Reset the Test component in the Prefab, it will be hidden again but only until you re-open the prefab.
    3. If you Reset the Test component in the Prefab Instance, you get a (Removed) script but only until you enter Play mode. See attached image.

    Removed.png

    In all cases the code in the Start() method executes just fine meaning that the Test script is effectively alive, which is not coherent with the indication that the Test script was removed.

    In my tool (GameFlow) I use hidden (disabled) components as serialized code blocks, thus the problem I am exposing here is currently ruining the integration of my tool with the new Prefab system as the Inspector is now populated by a number of these "falsely removed" components when inspecting prefab instances. That's not only pretty confusing for the user, but ugly as hell.

    So I beg you can fix this. Please only mark a script as removed when the script is actually removed, not hidden. If a script is hidden, please just keep it hidden. Respecting this is important for many of us. Thanks!
     
    Rallix likes this.
  2. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    First of all, thank you for bringing this to our attention. Secondly, please use the bug reporter to report bugs. The forums are not really suitable for this purpose. You can write about issues with 2018.3 here to bring further attention to it, but if there's no bug report, there's a higher risk that it will be overlooked or forgotten. A guide to beta testing.

    If you decide to submit a bug report it would be a good idea to post the issue ID in this thread as well.
     
    Peter77 likes this.
  3. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    xeleh likes this.
  4. xeleh

    xeleh

    Joined:
    Jul 22, 2016
    Posts:
    302
    Thanks so much!
     
  5. xeleh

    xeleh

    Joined:
    Jul 22, 2016
    Posts:
    302
    The issuetracker says this was "fixed in Unity 2018.3" but the issue is still present in b7.
     
  6. xeleh

    xeleh

    Joined:
    Jul 22, 2016
    Posts:
    302
    The issue is fixed in 2018.3b8. Yes!