AudioAsset
Ease
FastString
FontAsset
NineSlice
PackedSprite
PackedSpriteID
RB
   HardwareSettings
   IRetroBlitGame
RBAsset
Rect2i
ShaderAsset
SoundReference
SpriteGrid
SpriteSheetAsset
TMXMapAsset
   TMXLayer
   TMXLayerLoadState
   TMXObject
   TMXObjectGroup
   TMXProperties
Vector2i

RB.Clear

Method  -  Static

public static void Clear(Color32 color)
public static void Clear(Color32 color, Rect2i rect)

Parameters

color Color32 Color to clear with
rect Rect2i Region to clear

Returns

Nothing.

Description

Clears the display to the given color. Normally the entire screen is cleared, but a clear rect can also be passed to only clear a portion of the screen.

Note that clearing the screen or rect is not the same as drawing a solid color rect with RB.DrawRectFill. Drawing is an additive process, clearing sets pixels to the given color regardless of what the previous pixel color was. This distinction is most apparent when rendering to a sprite sheet by using RB.Offscreen. When rendering to a sprite sheet it may be desirable to sometimes erase a part of the sprite sheet by setting the pixels to be transparent (alpha = 0), the RB.Clear method is the only way to do that. See the Demo Reel example scene for clearing and drawing into a sprite sheet.

Example

void Render() {
    // Clear the entire screen to black
    RB.Clear(Color.black);

    RB.Print(new Vector2i(3264), Color.white, "Ah, it's nice and clean here!");
}

See Also

RB.Offscreen

See Docs

Features - Drawing into a Sprite Sheet