githubEdit

ConvertToManagedInvisible

Introduction

ManagedInvisible Sprites are Sprites which the SpriteManager performs every-frame updates on them (such as applying Velocity, Acceleration, and attachment logic). These Sprites are not drawn by the engine. For more information on managed invisible Sprites, see the AddManagedInvisibleSpritearrow-up-right method.

When to use ConvertToManagedInvisible

The most common way of creating managed invisible Sprites is to use SpriteManager.AddManagedInvisibleSpritearrow-up-right. However, the AddManagedInvisibleSpritearrow-up-right method both instantiates and places the newly-instantiated Sprite in the proper internal lists to make it managed invisible. If you are working with already-created Sprites, then you can use ConvertToManagedInvisible to convert the Sprites to be managed invisible Sprites.

Code Usage

Method signature:

public static void ConvertToManagedInvisible(Sprite sprite)

Common usage:

// assumes mySprite is a valid Sprite
SpriteManager.ConvertToManagedInvisible(mySprite);

Undoing ConvertToManagedInvisible

Since ConvertToManagedInvisible removes a Sprite from the engine, this function can be undone by re-adding the Sprite to the engine to be drawn. Specifically the SpriteManager.AddToLayerarrow-up-right method can be used to have the Sprite be drawn by the engine:

// assuming SpriteInstance is a valid Sprite and LayerInstance is a valid Layer:
SpriteManager.AddToLayer(SpriteInstance, LayerInstance);

To add the Sprite so it is drawn but not on a Layer, it can be removed from the SpriteManager using SpriteManager.RemoveSpriteOneWayarrow-up-right, then re-added using SpriteManager.AddSpritearrow-up-right:

Last updated

Was this helpful?