Asset bundles - ParkitectNexus/ParkitectNexusClient GitHub Wiki
Some mods requires custom models, that's no problem! You can use Asset Bundles to load custom models and other assets (everything except code). See the Unity tutorial on how to create/use Asset Bundles, click.
When you've made your asset bundles you can include them in your mod. Create a subfolder in your mod 'Asset Bundles'. Now head over to your mod.json and configure it, set AssetBundleDir to 'Asset Bundles' and AssetBundlePrefix to a prefix of your liking. Now when you restart the game, the client will copy all your asset bundles to (Parkitect folder)/Parkitect_Data/StreamingAssets/mods/(your asset bundle prefix)
. You can reach your asset bundles with the following piece on the following path:
Application.streamingAssetsPath + '/mods/your-prefix/your-asset-bundle-file'
An example to load a custom model:
void Start()
{
StartCoroutine(LoadShop());
}
private IEnumerator LoadShop()
{
using (WWW www = new WWW("file://" + Application.streamingAssetsPath + "/mods/your-prefix/"))
{
yield return www;
if (www.error != null)
throw new Exception("Download had an error:" + www.error);
AssetBundle bundle = www.assetBundle;
Instantiate(bundle.LoadAsset("MyCustomShopModel"));
bundle.Unload(false);
}
}