LayerBundle Class
Layers can define portrait and landscape UIs with the same name, and the LayerBundle class can be used to collectively retrieve and manipulate both portrait and landscape Layers.
If you want to manipulate portrait or landscape Layers individually, use the Layer class.
After obtaining a LayerBundle, if you want to manipulate portrait or landscape Layers individually, calling LayerBundle.GetCurrent() will get the Layer corresponding to the current orientation of the Canvas.
Also, the LayerBundle.portrait and LayerBundle.landscape fields contain the portrait and landscape Layers respectively.
How to Get LayerBundle
hsLayerGet
LayerBundle hsLayerGet(string LayerName)
Returns null if neither portrait nor landscape Layer exists.
hsLayerGetOwnScene
LayerBundle hsLayerGetOwnScene(string LayerName)
When hsLayerGetOwnScene is called from code within an activity, it searches for LayerName from the Canvas within the activity.
Returns null if neither portrait nor landscape Layer exists.
LayerBundle Fields
portrait
Layer portrait
landscape
Layer landscape;
LayerBundle Methods
ToString
string ToString()
SetShow
void SetShow(bool Show)
IsShow
bool IsShow()
StartLayerAnimation
void StartLayerAnimation(string Type, float Value)
GetCurrent
Layer GetCurrent()
CallComponentMethod
bool CallComponentMethod(string ComponentName, string MethodName, string Params)
Specify the component name with ComponentName and the method name with MethodName to call the method. The string specified by Params is passed as an argument.
Callable methods have the following restrictions:
- Must have only one string argument.
- Return value must be void.
CanvasSetGUIText
bool CanvasSetGUIText(string GUIName, string Text)
Returns false if the GUI element is not found in either portrait or landscape Layer.
SetGUIShow
bool SetGUIShow(string GUIName, bool Show)
Returns false if the GUI element is not found in either portrait or landscape Layer.
GUI types that can call this method
- button
- image
- slider
- text
CanvasSetGUITextAlignment
bool CanvasSetGUITextAlignment(string GUIName, int Alignment)
Returns false if the GUI element is not found in either portrait or landscape Layer.
GUI types that can call this method
- text
CanvasSetGUITextOverflowWrap
bool CanvasSetGUITextOverflowWrap(string GUIName, bool OverflowWrap)
Returns false if the GUI element is not found in either portrait or landscape Layer.
GUI types that can call this method
- text
CanvasSetGUITextURLClickable
bool CanvasSetGUITextURLClickable(string GUIName, bool URLClickable)
Returns false if the GUI element is not found in either portrait or landscape Layer.
GUI types that can call this method
- text
CanvasSetGUIImage
bool CanvasSetGUIImage(string GUIName, string Path)
Returns false if the GUI element is not found in either portrait or landscape Layer.
GUI types that can call this method
- button
- image
StartGUIAnimation
void StartGUIAnimation(string GUIName, string Type, float Value)
GUI types that can call this method
- button
- image
- slider
- text