Enabling a hidden GameObject with a MeshRenderer - makes it visible in previews.

I’d like to confirm this is a bug, and not something I am doing wrong.

Given the monobehavior below:

If I click in its inspector - createItHidden , then click createItNow, then disable, and renable this monobehavor object:

The created object is visible, not only in the scene, but ALSO in the project’s icons, an inspectors preview’s (materials, models)

public class HiddenObjectCreator : MonoBehaviour {

    public GameObject hiddenObject;
    public bool createItNow = false;
    public bool createItHidden = false;

    private void OnEnable()

    private void OnDisable()
        if (hiddenObject)
    // Update is called once per frame
    void Update ()
        if (createItNow)
            createItNow = false;
            hiddenObject = GameObject.CreatePrimitive(PrimitiveType.Cube);
            hiddenObject.transform.localScale = new Vector3(.1f, 2, .1f);
            if (createItHidden)
                hiddenObject.hideFlags = HideFlags.HideAndDontSave;

Got an email back from Unity; it is indeed a bug: