wiki.sine.space | sinespace

Scripting/SUICanvas

From wiki.sine.space
Revision as of 02:08, 25 December 2020 by Edisonwu (Talk | contribs) (Created page with "SUICanvas is root component for UI elements. =Properties= {{ScriptFunction|bool|IsRootCanvas|{get;}|The avoidance radius for the agent.|5=local canvas=Space.Host.GetReferen...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

SUICanvas is root component for UI elements.

Properties

IsRootCanvas

bool IsRootCanvas {get;}

The avoidance radius for the agent.

local canvas=Space.Host.GetReference("Canvas").UICanvas

Space.Log(canvas.IsRootCanvas)

--print true.


ReferencePixelsPerUnit

float ReferencePixelsPerUnit {get; set;}

If a sprite has this "Pixels Per Unit" setting, then one pixel in the sprite will cover one unit in the UI.

local canvas=Space.Host.GetReference("Canvas").UICanvas

Space.Log(canvas.ScaleFactor)

--return scale factor.


ScaleFactor

float ScaleFactor {get; set;}

Scales all UI elements in the Canvas by this factor.

local canvas=Space.Host.GetReference("Canvas").UICanvas

Space.Log(canvas.ReferencePixelsPerUnit)

--return reference pixels per unit.


PixelPerfect

bool PixelPerfect {get; set;}

Should the UI be rendered without antialiasing for precision?

local canvas=Space.Host.GetReference("Canvas").UICanvas
Space.Log(canvas.PixelPerfect)


PlaneDistance

float PlaneDistance {get; set;}

The distance at which the UI plane should be placed in front of the camera.

local canvas=Space.Host.GetReference("Canvas").UICanvas

Space.Log(canvas.PlaneDistance)

--return plane distance.


SortingOrder

int SortingOrder {get; set;}

Canvas' order within a sorting layer.

local canvas=Space.Host.GetReference("Canvas").UICanvas

Space.Log(canvas.SortingOrder)

--return sorting order.


TargetDisplay

int TargetDisplay {get; set;}

For Overlay mode, display index on which the UI canvas will appear.

local canvas=Space.Host.GetReference("Canvas").UICanvas
Space.Log(canvas.TargetDisplay)


SortingOrder

int SortingOrder {get; set;}

Canvas' order within a sorting layer.

local canvas=Space.Host.GetReference("Canvas").UICanvas

Space.Log(canvas.SortingOrder)

--return sorting order.



NormalizedSortingGridSize

float NormalizedSortingGridSize {get; set;}

The normalized grid size that the canvas will split the renderable area into.

local canvas=Space.Host.GetReference("Canvas").UICanvas

Space.Log(canvas.NormalizedSortingGridSize)

--return normalized sorting grid size.