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:
using UnityEngine;
namespace Betatesting {
public class Test : MonoBehaviour {
void Reset() {
hideFlags = HideFlags.HideInInspector;
}
void Start() {
Debug.Log("I'm alive!");
}
}
}
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:
- 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.
- If you Reset the Test component in the Prefab, it will be hidden again but only until you re-open the prefab.
- 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.
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!