Class SpriteRender
Sprite rendering object.
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/UI/SpriteRender.h
Syntax
public class SpriteRender : public Actor
Fields
DrawModes
The draw passes to use for rendering this object. Uncheck Depth
to disable sprite casting shadows.
Declaration
public DrawPass DrawModes = DrawPass::Default
Field Value
DrawPass
|
FaceCamera
If checked, the sprite will automatically face the view camera, otherwise it will be oriented as an actor.
Declaration
public bool FaceCamera = true
Field Value
bool
|
Image
The sprite texture to draw.
Declaration
public AssetReference<Texture> Image
Field Value
AssetReference<Texture>
|
Material
The material used for the sprite rendering. It should contain texture parameter named Image and color parameter named Color. For showing sprites from sprite atlas ensure to add Vector4 param ImageMAD for UVs transformation.
Declaration
public AssetReference<MaterialBase> Material
Field Value
AssetReference<MaterialBase>
|
SortOrder
Gets the object sort order key used when sorting drawable objects during rendering. Use lower values to draw object before others, higher values are rendered later (on top). Can be used to control transparency drawing.
Declaration
public int8 SortOrder = 0
Field Value
int8
|
Methods
Deserialize(DeserializeStream& stream, ISerializeModifier* modifier)
Deserializes object from the input stream.
Declaration
public virtual void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override
Parameters
DeserializeStream
stream
The input stream. |
ISerializeModifier
modifier
The deserialization modifier object. Always valid. |
Overrides
Draw(RenderContext& renderContext)
Draws this actor. Called by Scene Rendering service. This call is more optimized than generic Draw (eg. geometry is rendered during all pass types but other actors are drawn only during GBufferFill pass).
Declaration
public virtual void Draw(RenderContext& renderContext) override
Parameters
RenderContext
renderContext
The rendering context. |
Overrides
GetColor()
Gets the color of the sprite. Passed to the sprite material in parameter named Color
.
Declaration
public Color GetColor() const
Returns
Color
|
GetSize()
Gets the size of the sprite.
Declaration
public Float2 GetSize() const
Returns
Float2
|
GetSprite()
Gets the sprite to draw. Used only if Image is unset.
Declaration
public SpriteHandle GetSprite() const
Returns
SpriteHandle
|
HasContentLoaded()
Returns true if actor has loaded content.
Declaration
public virtual bool HasContentLoaded() const override
Returns
bool
|
Overrides
OnDisable()
Called when actor gets removed from game systems. Occurs on EndPlay event or when actor gets inactivated in hierarchy. Use this event to unregister object from other game system (eg. audio).
Declaration
protected virtual void OnDisable() override
Overrides
OnEnable()
Called when actor gets added to game systems. Occurs on BeginPlay event or when actor gets activated in hierarchy. Use this event to register object to other game system (eg. audio).
Declaration
protected virtual void OnEnable() override
Overrides
OnEndPlay()
Called when removing object from the game.
Declaration
public virtual void OnEndPlay() override
Overrides
OnLayerChanged()
Called when layer gets changed.
Declaration
public virtual void OnLayerChanged() override
Overrides
OnTransformChanged()
Called when actor transform gets changed.
Declaration
protected virtual void OnTransformChanged() override
Overrides
Serialize(SerializeStream& stream, const void* otherObj)
Serializes object to the output stream compared to the values of the other object instance (eg. default class object). If other object is null then serialize all properties.
Declaration
public virtual void Serialize(SerializeStream& stream, const void* otherObj) override
Parameters
SerializeStream
stream
The output stream. |
void
otherObj
The instance of the object to compare with and serialize only the modified properties. If null, then serialize all properties. |
Overrides
SetColor(const Color& value)
Sets the color of the sprite. Passed to the sprite material in parameter named Color
.
Declaration
public void SetColor(const Color& value)
Parameters
Color
value
|
SetSize(const Float2& value)
Sets the size of the sprite.
Declaration
public void SetSize(const Float2& value)
Parameters
Float2
value
|
SetSprite(const SpriteHandle& value)
Sets the sprite to draw. Used only if Image is unset.
Declaration
public void SetSprite(const SpriteHandle& value)
Parameters
SpriteHandle
value
|