m |
(Added simple example to SUIText.AlignByGeometry) |
||
Line 4: | Line 4: | ||
{{ScriptFunction|bool|AlignByGeometry|{get;set;}|Use the range of glyph geometry to perform horizontal alignment. |5= | {{ScriptFunction|bool|AlignByGeometry|{get;set;}|Use the range of glyph geometry to perform horizontal alignment. |5= | ||
+ | <pre> | ||
+ | thisObject = Space.Host.ExecutingObject | ||
+ | --get a reference to our object | ||
+ | thisObjectText = thisObject.UIText | ||
+ | --get a reference to the SUIText component in our object | ||
+ | |||
+ | Space.Log(thisObjectText.AlignByGeometry) | ||
+ | --This will return "true" or "false" to your debugger console | ||
+ | --telling you if the Align By Geometry feature is on or not (false by default) | ||
+ | |||
+ | |||
+ | thisObjectText.AlignByGeometry = true | ||
+ | --This enables the Align By Geometry feature | ||
+ | |||
+ | Space.Log(thisObjectText.AlignByGeometry) | ||
+ | --This will return "true" to your debugger console | ||
+ | |||
+ | thisObjectText.AlignByGeometry = false | ||
+ | --This disables the Align By Geometry feature | ||
+ | |||
+ | Space.Log(thisObjectText.AlignByGeometry) | ||
+ | --This will return "true" to your debugger console | ||
+ | </pre> | ||
}} | }} |
The SUIText class provides tools to work with the SUIText component, which is a component responsible for displaying text
Use the range of glyph geometry to perform horizontal alignment.
thisObject = Space.Host.ExecutingObject --get a reference to our object thisObjectText = thisObject.UIText --get a reference to the SUIText component in our object Space.Log(thisObjectText.AlignByGeometry) --This will return "true" or "false" to your debugger console --telling you if the Align By Geometry feature is on or not (false by default) thisObjectText.AlignByGeometry = true --This enables the Align By Geometry feature Space.Log(thisObjectText.AlignByGeometry) --This will return "true" to your debugger console thisObjectText.AlignByGeometry = false --This disables the Align By Geometry feature Space.Log(thisObjectText.AlignByGeometry) --This will return "true" to your debugger console
Base color of the Graphic.
--This script dynamically changes the text's color of a GameObject with UIText component. --For example in a text sign over your shop that you want to make more visually stand out --or perhaps text decoration during a celebration or a text element in your User Interface or HUD. thisObject = Space.Host.ExecutingObject --get a reference to our object thisObjectText = thisObject.UIText --get a reference to the SUIText component in our object colors = {Color.Red, Color.Black, Color.White, Color.Blue, Color.Green, Color.Yellow} --here we are holding 6 predefined colors in a Lua Table which we will go through function ColorChanger() while true do --infinite loop for i=1,#colors do --For Loop to cycle through all the table items thisObjectText.color = colors[i] --this will set the color based on which item in the table we are now at coroutine.yield(0.1) --this will pause for a tenth of a second before we change to the next color end end end thisObjectText.color = Color.Red --this is how to set text color using one of the predefined colors in the SColor class. thisObjectText.color = Color.New(0,0,0,1) --this sets our text color to Black (RGB 000) but also Alpha to 1 (meaning fully opaque, not transparent) colorOfThisObject = thisObjectText.color thisObjectText.color = colorOfThisObject --The color property also allows you to "get" it, not only "set" it, meaning you can get --your text's current color and save it. In this case, the color of your text wouldn't change. --The last 4 lines of code above are not important to this color changing script, it's just extra information for you. Space.Host.StartCoroutine(ColorChanger) --this coroutine will now call our ColorChanger() function which is infinitely changing our text colors between a select range.
Enabled Behaviours are Updated, disabled Behaviours are not.
Called by the layout system.
Called by the layout system.
The size that the Font should render at.
Called by the layout system.
Line spacing, specified as a factor of font line height. A value of 1 will produce normal line spacing.
Called by the layout system.
Called by the layout system.
Provides information about how fonts are scale to the screen.
Called by the layout system.
Called by the layout system.
Should the text be allowed to auto resized.
No documentation
The minimum size the text is allowed to be.
Whether this Text will support rich text.
The string value this Text displays.
|