1

I have made a prefab that also had a canvas. Unity added a Canvas Environment as the parent. Never had an issue until today. For some unknown reason, when I try to edit the prefab, the Canvas Environment is greyed out and not ticked in the inspector, and I am therefore unable to see any of the prefab in edit mode. I am unable to tick it in inspector to activate it.

Any ideas? It has happened to all prefabs that have a Canvas Environment. What have I accidentally done :(

Version 2019.3.7f1 Picture of inspector: https://ibb.co/FJSz79q Picture of Prefab hierarchy: https://ibb.co/bm6NbhL

turbo100
  • 33
  • 1
  • 5

3 Answers3

5

You can set UI environment through Edit > Project Settings > Editor > UI Environment. A scene asset can be set there. If the set scene contains a Canvas component, it will be used as an Environment for UI prefab edit mode. Go to that scene and make sure Canvas is not disabled there.

tsvedas
  • 1,049
  • 7
  • 18
  • Thank you, this fixed it. However, do you know why it suddenly became necessary? I never set the UI Environment before and I could view UI prefabs with no problem. – DoomGoober Apr 20 '22 at 21:52
  • @DoomGoober prefab mode (context/environment/whatever you call it) was a feature introduced in Unity 2020.1 (someone correct me if I am wrong). Before that there was no context and thus no Canvas to enable/disable. I would guess that you just updated Unity and that was the new feature that came with the update. – tsvedas Apr 21 '22 at 09:49
2

The New Unity Editor Version has this feature after 2020!!! Its no matter. when you open a Prefab,enter Prefab Stage,the Editor will check any node has UI Element, if there is, then In the Hierachy Window will Add a Canvas as Environment.

0

You have disabled the canvas by accident, in the inspector for the canvas click the little box on the left of the name to enable it again.

Qube
  • 1