Class MaterialLibrary
Allows for quick and simple retrieval of any base-game material throughout both Subnautica and Subnautica:
Below Zero. Materials can either be fetched directly using their names by accessing the FetchMaterial(string, IOut<Material>, bool)
method, or applied generically across the entirety of a custom prefab via the ReplaceMockMaterials method.
public static class MaterialLibrary
- Inheritance
-
MaterialLibrary
- Inherited Members
Methods
FetchMaterial(string, IOut<Material>, bool)
Searches the library for the provided materialName, and loads it from its path, if an entry for
it exists.
public static IEnumerator FetchMaterial(string materialName, IOut<Material> foundMaterial, bool warnIfFailed = true)
Parameters
materialNamestring- The exact name of the material you wish to retrieve as seen in-game. Case-sensitive!
foundMaterialIOut<Material>- The TaskResult<> to load the vanilla material into, if found. Otherwise, has its value set to null.
warnIfFailedbool- Whether Nautilus should log a warning if no materials with the provided materialName are found.
Returns
FetchMaterials(string[], IOut<Material[]>, bool)
Searches the library for all of the provided materialNames, and loads those materials from their
paths, if entries for them exist. If only some of the given mat names have entries in the library, this method
will return all of the vanilla materials it can, and will log warnings for those that it fails to find, by default.
public static IEnumerator FetchMaterials(string[] materialNames, IOut<Material[]> foundMaterials, bool warnIfFailed = true)
Parameters
materialNamesstring[]- An array of the exact material names that you wish to retrieve, as seen in-game. Case-sensitive!
foundMaterialsIOut<Material[]>- The TaskResult<> to load the vanilla materials into, if found. Will contain as many of the requested vanilla materials as can be found within the library.
warnIfFailedbool- Whether Nautilus should log a warning if one of the requested materialNames can not be found in the library.
Returns
GetMaterialPath(string)
Uses the Nautilus.Utility.MaterialLibrary._filePathMap to retrieve the path associated with a specified material using the
materialName, so that it may be loaded when requested.
public static string GetMaterialPath(string materialName)
Parameters
materialNamestring- The name of the material whose path is being requested.
Returns
- string
- The path to the resource which should be loaded in order to retrieve the specified material. Points to either a mat, prefab, or scene prefab file. Returns an empty string if the provided materialName does not have an entry within the library.