These are a set of functions for easily importing assets from anywhere within the BepInEx plugins folder.
TRAssets.ImportTexture(relativePath) | Imports and returns a Texture2D. |
TRAssets.ImportSprite(relativePath, pivot) | Imports a Texture2D and creates a Sprite with it. |
TRAssets.ListAllTextures(relativePath) | Creates a list of the paths to all image files in a folder that can be imported as textures. |
TRAssets.ListAllFiles(relativePath, validExtensions) | Creates a list of the paths to all files in a folder with one of the given file extensions. |
In each of the above functions, the relativePath argument is the path of your asset relative to the plugins folder. It's also recommended to use the Path.Combine function rather than using slashes. So, if your file is "Dinkum/BepInEx/plugins/YourModName/textures/example_texture.png", then the relative path would be Path.Combine("YourModName", “textures”, “example_texture.png”);