🖼️ Texture Overrides
Code Referencenamespace: CloverAPI.Content.Textures
class: TextureManager
You can override in-game textures with your own custom image files using the TextureManager
class.
Supported Formats
CloverAPI supports all Unity-supported image formats: PNG
, JP(E)G
, BMP
, TGA
, and GIF
(static images only). PNG
is recommended for best compatibility.
Registering Texture Overrides
To register a texture override, use the TextureManager.RegisterTextureOverride(string name, Texture2D texture, ModGuid guid)
method.
The name
parameter is the name of the texture to override. The easiest way to find the name is to look at the texture's or sprite's filename in the game's files using a tool like AssetStudio. The texture
parameter is the Texture2D
instance to use as the override. You can use the TextureUtils.LoadTextureFromFile(string filePath, FilterMode filterMode = FilterMode.Point)
method to load a texture from a file. The filterMode
parameter determines how the texture is filtered when scaled. Point
is recommended for pixel art, while Bilinear
or Trilinear
may be better for high-resolution textures in some cases.
The guid
parameter is the ModGuid
of your mod. Pass either your plugin instance or a string. It'll be converted automatically.