-
Notifications
You must be signed in to change notification settings - Fork 2
Using custom assets
Custom assets refer to any additional resources, such as textures, models, sounds, or other files, that your mod utilizes. If your mod makes use of custom assets and relies on the "LoadAsset" function, you need to set a specific flag to indicate this. This guide will walk you through the process of enabling the use of custom assets in your mod.
If you don't know how to create assets, go here.
In your mod's code, you can enable the use of custom assets by setting a boolean property. If your mod uses the "LoadAsset" function, you need to set this property to true.
public override bool UseAssets => true;Once you've enabled custom assets in your mod, you can utilize the "LoadAsset" function to load and use custom resources dynamically during runtime. This function allows your mod to access and integrate custom assets seamlessly.
You can use this function anywhere, anytime in your code. For example:
var loadedObject = LoadAsset<T>("assetName", "prefabName", "fileSuffix", "prefabSuffix");-
Tis the type that will be returned; this can be, for example,GameObject, orTexture2D, and so on -
assetNameis the exported assetbundle's name -
prefabNameis the prefab's name in the editor -
fileSuffixis the exported assetbundle's file suffix, usually this is just blank (""), although usually.unity3dis used -
prefabSuffixis the prefab's suffix; for GameObjects, use.prefab; for other types, use their respective suffix, as in the editor
You can then use the loadedObject variable anywhere in your code - for example, if it's a GameObject, you can now do Instantiate(loadedObject);
- Full Linux guide
- Installing JaLoader via JaPatcher
- Installing mods
- Adding Custom Songs
- Custom Paintjobs