bool TryValueAs<T>(out T value)
Try casting object value to any type
______________________________________________________________________________________________________________________________
bool: If the cast was successful
↩️ Back
TryValueAs can be used for safe value casting, it prevents errors if used as an if statement
if(ModExtraAssets.GetEntry<Texture2D>("MyLoadedTexture").TryValueAs(out Texture textureBaseClass))
{
Debug.Log(textureBaseClass.GetType().Name);
}