The UICanvas main purpose is to give any UINotification, you want to show, a target container.
It is also used for other Inspector related actions that help you out in designing your UI. For example, when you want to create a new UIElement, it will get automatically parented to the selected UICanvas gameObject, or if no UI related gameObject is selected, it will get parented to the UICanvas named ‘Master Canvas’.
You can consider the gameObject that has an UICanvas attached as your main UI container. Of course, you will also find a native Canvas component attached to the same gameObject, that is your rootCanvas.
Canvas Name: the name of this canvas (used in order to be able to identify it)
custom Canvas Name: is used by the custom inspector to allow you to type a canvas name instead of selecting it from the Canvas Names Database; this option can also be used to add a new canvas name and you can do that in four easy steps:
- Enable custom name
- Enter a new name
- Disable custom name
- A display dialog will appear asking you if you want to add the new name to the database (click yes)
Don’t Destroy on Load: makes the UICanvas gameObject not get destroyed automatically when loading a scene; this allows your UI to persist across scenes and it is quite useful when working (loading/unloading) a lot of scenes
Fields
Name |
Description |
canvasName |
The name of this canvas. |
customCanvasName |
Used by the custom inspector to allow you to type a canvas name instead of selecting it from the Canvas Names Database. |
dontDestroyOnLoad |
Makes this UICanvas gameObject not get destroyed automatically when loading a new scene. |
MASTER_CANVAS_NAME |
Default name given to a new canvas. The name is 'MasterCanvas' and you should have ONLY ONE per scene as this is considered your main/default canvas. |
Properties
Name |
Description |
Canvas |
Returns the Canvas component. |
IsMasterCanvas |
Returns true if this canvas name is 'MasterCanvas' and if it has been registered to the UIManager as the MasterCanvas |
RectTransform |
Returns the RectTransform component. |
Methods
Name |
Description |
RegisterToUIManager() |
Registers this UICanvas to the UIManager. |
UnregisterFromUIManager() |
Unregisteres this UICanvas from the UIManager. |
Comments
0 comments
Please sign in to leave a comment.