Heroic Engine
  • Welcome
  • Getting Started
    • Quickstart
    • Example Games
      • Tic Tac Toe
      • Turn based duel
  • Basics
    • Injection Manager
    • Engine Systems
      • Core Systems
        • Events Manager
        • Input Manager
        • Localization Manager
          • LangText component
        • Music Player
        • Sounds Manager
        • Time Manager
        • Scenes Loader
        • Day Time Controller
        • Weather Controller
      • Gameplay Systems
        • Currencies Manager
        • Player Progression Manager
        • Quest Manager
        • Random Events Manager
        • Hittables Manager
        • Dungeon Generator
      • UI Systems
        • UI Controller
        • Countdown Controller
    • Editor Tools
      • Clear Saves
      • Mobile Build Optimizer
      • Create System
      • Icon from Prefab Generator
    • Engine Utilities
      • PoolSystem
      • DataSaver
      • ComponentExtensions
      • MaterialExtensions
      • SpriteUtils
      • SlowUpdate
      • StringUtils
      • TypeUtility
      • MathHelper
      • VectorUtils
      • TransformUtils
      • MeshUtils
    • Useful Components
      • Floating Item
      • Fly Up Text
      • Label Scaler
      • Ragdoll
      • Rotate To Camera
      • Orbital Camera
      • Rotator
      • Texture Mover
      • Hittable
      • Projectile
      • Projectile2D
      • LifetimeObject
      • Spawner
      • Colorized Particles
      • Draggable2D
      • SaveableTransform
    • Useful Attributes
Powered by GitBook
On this page
  1. Basics
  2. Engine Utilities

SpriteUtils

This static class provides functionality for working with Sprites. Currently it contains only 2 methods, which generates Texture2D from Sprite or creates Sprite from Texture2D, but it could be pretty useful. In future we're planning to add more functionality to this class.

Available methods

public static Texture2D TextureFromSprite(this Sprite sprite)

This extension method creates Texture2D from given sprite.

Example:

Texture2D myTex = mySprite.TextureFromSprite();

public static Sprite SpriteFromTexture (this Texture2D texture)

This extension method creates Sprite from given texture.

Example:

myImage.sprite = myTex.SpriteFromTexture();
PreviousMaterialExtensionsNextSlowUpdate

Last updated 4 months ago