Alpha 17e has introduced native support in loading Unity's unity3d asset bundles. What this means to us, is that we can load in custom blocks and entities, as well as adding new sounds into the game, without using SDX.
** Note: Any modlets that use Asset Bundles must be installed on the Client and the Server **
This is going to be a short tutorial just to get you started by showing you which hooks we have available to us. It's not meant to be a full tutorial on how to use unity.
All of the hooks below use the following syntax:
Example:
I have a sound file called myBatteryBankSound, stored in the mysound.unity3d asset bundle. My Mod is called SphereII_Tutorial. It only contains an xpath to change the sound ClipName.
[/CODE]
@modfolder: is updated at run time and replaced as Mods/SphereII_Tutorial/
In the exported configs, you'd see
<AudioClip ClipName="#@modfolder(SphereII_Tutorial):Resources/mysound.unity3d?myBatteryBankSound" Loop="true"/>
he type of prefab and asset you make depends on the context in what you'll want to use it in. For example, in the above example, myBatteryBankSound must be a supported sound file, otherwise the game will not load it. Likewise, if you try to load up a Model on the block, it has to be a block prefab in Unity.
Unity 2018.2.18
For Alpha 17e, Unity 2018.2.0f is used by the game. You must use a unity version that matches that, although the last digit is less important. For example, you could probably use 2018.2.18.
https://unity3d.com/get-unity/download/archive?_ga=2.59587373.189228578.1543509469-764944493.1525198827
Export Asset Bundles:
The ExportAssetBundles.ca has been hosted here: https://github.com/7D2D/Templates-and-Utilities
In Unity, drag and drop the exportassetbundles.cs into Assets window. It'll compile and add itself to the right click, context menu.
Tutorials
The following tutorials are still mostly valid for creating unity blocks and entities. We'll be working on newer tutorials. The biggest difference is that the version of Unity that we are using is much newer, but the workflow should be the same.
https://7d2dsdx.github.io/Tutorials/
The following post will include all currently known modfolder hooks.
** Note: Any modlets that use Asset Bundles must be installed on the Client and the Server **
This is going to be a short tutorial just to get you started by showing you which hooks we have available to us. It's not meant to be a full tutorial on how to use unity.
All of the hooks below use the following syntax:
Code:
#@modfolder:<ModSubFolder>/<Unity3DFile>?<UnityPrefabName>
# is the hook that makes the code going down a different path to load.
@modfolder: At run time, this gets resolved to Mods/MyMod/ path where the Unity3D file is found.
<ModSubFolder> This is a subfolder in your MyMod folder, that will hold the resources. Typically it's called "Resources".
<Unity3DFile> This is the full unity3d file name, including extension, of your unity asset bundle.
? Is a hook to tell the game to load the follow as a prefab
<UnityPrefabName> This is your unity prefab name.
I have a sound file called myBatteryBankSound, stored in the mysound.unity3d asset bundle. My Mod is called SphereII_Tutorial. It only contains an xpath to change the sound ClipName.
Code:
Mods/SphereII_Tutorial/Config/sounds.xml
Mods/SphereII_Tutorial/Resources/mysound.unity3d
Mods/ModInfo.xml
sounds.xml:
<configs>
<set xpath="/Sounds/SoundDataNode[@name='batterybank_idle']/AudioClip/@ClipName">#@modfolder:Resources/mysound.unity3d?myBatteryBankSound</set>
</configs>
@modfolder: is updated at run time and replaced as Mods/SphereII_Tutorial/
In the exported configs, you'd see
<AudioClip ClipName="#@modfolder(SphereII_Tutorial):Resources/mysound.unity3d?myBatteryBankSound" Loop="true"/>
he type of prefab and asset you make depends on the context in what you'll want to use it in. For example, in the above example, myBatteryBankSound must be a supported sound file, otherwise the game will not load it. Likewise, if you try to load up a Model on the block, it has to be a block prefab in Unity.
Unity 2018.2.18
For Alpha 17e, Unity 2018.2.0f is used by the game. You must use a unity version that matches that, although the last digit is less important. For example, you could probably use 2018.2.18.
https://unity3d.com/get-unity/download/archive?_ga=2.59587373.189228578.1543509469-764944493.1525198827
Export Asset Bundles:
The ExportAssetBundles.ca has been hosted here: https://github.com/7D2D/Templates-and-Utilities
In Unity, drag and drop the exportassetbundles.cs into Assets window. It'll compile and add itself to the right click, context menu.
Tutorials
The following tutorials are still mostly valid for creating unity blocks and entities. We'll be working on newer tutorials. The biggest difference is that the version of Unity that we are using is much newer, but the workflow should be the same.
The following post will include all currently known modfolder hooks.
Last edited by a moderator: