Component:SpriteProvider: Difference between revisions

From Resonite Wiki
Automated: update component fields
Automated: update 'HighPriorityIntegration' description
 
(4 intermediate revisions by 3 users not shown)
Line 2: Line 2:
<translate>
<translate>
<!--T:1-->
<!--T:1-->
{{stub}}
{{Infobox Component
{{Infobox Component
|Image=SpriteProviderComponent.png
|Image=SpriteProviderComponent.png
Line 9: Line 8:


<!--T:2-->
<!--T:2-->
== Intoduction ==
== Introduction ==


A '''SpriteProvider''' component provides a [[Sprite]] for an [[Image (Component)|Image]]. This can be used to display graphics and produce backgrounds.
A '''SpriteProvider''' defines a slice of a [[Texture2D]] as a [[Sprite]] that may be used by other components e.g. [[UIX]] [[Component:Image|Images]] to display graphics or produce backgrounds.


<!--T:3-->
<!--T:3-->
== Usage ==
== Usage ==
{{Table ComponentFields
{{Table ComponentFields
|HighPriorityIntegration|Bool|
|HighPriorityIntegration|Bool|{{Asset HighPriorityIntegration Field}}
|Texture|{{RootFieldType|AssetRef`1|[[Type:ITexture2D|ITexture2D]]}}|TypeAdv1=true|The sprite to provide.
|Texture|{{RootFieldType|AssetRef`1|[[Type:ITexture2D|ITexture2D]]}}|TypeAdv1=true|The sprite to provide.
|Rect|Rect|The rectangle within the sprite to render. Note that the second x and y are actually the width and height of the Rect. The values are proportions of the width and height of the image in the Texture property.
|Rect|Rect|The rectangle within the sprite to render. Note that the second x and y are actually the width and height of the Rect. The values are proportions of the width and height of the image in the Texture property.
|Borders|Float4|
|Borders|Float4|Border widths for [[9-slice scaling]]. The XYZW components set the left, bottom, right, and top borders respectively.
|Scale|Float|
|Scale|Float|
|FixedSize|Float|
|FixedSize|Float|
Line 26: Line 25:
<!--T:4-->
<!--T:4-->
== Behavior ==
== Behavior ==
Sprite providers due to the current Unity implementation at the time of writing this have issues with switching images very quickly. They will often flash white, causing a health hazard to photo sensitive users. Having all the sprites on UIX elements at once and switching their <code>OrderOffset</code> to change which element renders on top will remove the flashing and is currently the only way to combat this issue.


<!--T:5-->
<!--T:5-->
Line 34: Line 34:
== Related Components ==
== Related Components ==
</translate>
</translate>
[[Category:Components{{#translation:}}|SpriteProvider(Component){{#translation:}}]]
[[Category:Components{{#translation:}}|Sprite Provider]]
[[Category:ComponentStubs]]
[[Category:ComponentStubs]]
[[Category:Components:Assets{{#translation:}}|SpriteProvider(Component){{#translation:}}]]
[[Category:Components:Assets{{#translation:}}|Sprite Provider]]

Latest revision as of 11:59, 1 August 2024

Component image 
SpriteProvider component as seen in the Scene Inspector


Introduction

A SpriteProvider defines a slice of a Texture2D as a Sprite that may be used by other components e.g. UIX Images to display graphics or produce backgrounds.

Usage

Fields
Name Type Description
persistent Bool Determines whether or not this item will be saved to the server.
UpdateOrder Int Controls the order in which this component is updated.
Enabled Bool Controls whether or not this component is enabled.
HighPriorityIntegration Bool If true, integrating this asset (e.g. processing procedural assets) gets higher priority than assets with this flag off. An example is user laser procedural meshes.
Texture ITexture2D The sprite to provide.
Rect Rect The rectangle within the sprite to render. Note that the second x and y are actually the width and height of the Rect. The values are proportions of the width and height of the image in the Texture property.
Borders Float4 Border widths for 9-slice scaling. The XYZW components set the left, bottom, right, and top borders respectively.
Scale Float
FixedSize Float

Behavior

Sprite providers due to the current Unity implementation at the time of writing this have issues with switching images very quickly. They will often flash white, causing a health hazard to photo sensitive users. Having all the sprites on UIX elements at once and switching their OrderOffset to change which element renders on top will remove the flashing and is currently the only way to combat this issue.

Examples

ProbablePrime's video on Sprites

Related Components