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() { RB.Clear(Color.black);
RB.Print(new Vector2i(32, 64), Color.white, "Ah, it's nice and clean here!"); } |
See Also
RB.Offscreen
See Docs
Features - Drawing into a Sprite Sheet
|