Custom Unity Assets (CUA) Introduction & Creator Guides:
The CustomUnityAsset atom is a powerful tool that allows importing assets (prefabs or scenes) from Unity.
You can use a free version of Unity to make custom objects and full maps (scenes) for VaM.
Loading a Custom Asset
Create CustomUnityAsset atom using the standard add atom method (Misc -> CustomUnityAsset -> Add Object).
Select the CustomUnityAsset and open the UI. You should see a panel like this
Click the 'Select File...' button.
Browse to the custom asset file. This will filter for *.assetbundle and *.scene files. Either can be used.
Once file is selected, it could take some time to load the file. You may see a loading please wait indicator.
Once loading is complete, the dropdown list should contain the scenes and prefabs that are contained in the assetbundle file.
You can select which one you want to use. After selection, the object should appear in the scene.
Make sure you have a light source in the scene or you might not be able to see it.
Several excellent tutorials exist within the VaMHub database.
One of the best is by MacGruber, it includes a prebuilt project, assets and a detailed PDF that walks you through the entire process.
Unity AssetBundles for VaM
Hazmhox also has an excellent guide.
The definitive asset creation tutorial for VaM
VamTastic wrote Creating Prefabs in Unity.
Zgock resource: How to Make AutoFollowed and SpringBoned CUA Hair with CUAAutoFollow and EZSoftBone
Advanced: Installing Unity and the AssetBundle Browser from scratch:
The version of Unity that is compatible with VaM assetbundles is version 2018.1.9f1. You can download this version from here.
Save the exe into a local folder and then install Unity into a convenient location. If you don’t already have it installed you can also install the Unity Hub which is available here.
After installation, run the Unity Hub and click “Locate” and point it to the install location of 2018.1.9f1.
It should now show up in your list of installs.
Go to the Projects Tab.
Click on New.
Select version 2018.1.9f1 of Unity
A new Dialog box will appear. Select 3D Template, Enter a Project Name, and a Location for your project to live.
Installing Asset Bundle Browser
Unity will now open with default UI settings.
Next you will need to install the Asset Bundle Browser which is available for free. Go to Window / Package Manager.
The Package Manager window will open. Select Asset Bundle Browser and click on Install.
Add AssetBundles window to your Unity UI. Window->AssetBundle Browser. Drag it somewhere you prefer.
Unity Settings
CUA Full Scene Method
CUA Adding a DLL to load with the asset or environment
The CustomUnityAsset atom is a powerful tool that allows importing assets (prefabs or scenes) from Unity.
You can use a free version of Unity to make custom objects and full maps (scenes) for VaM.
Loading a Custom Asset
Click the 'Select File...' button.
Browse to the custom asset file. This will filter for *.assetbundle and *.scene files. Either can be used.
Once file is selected, it could take some time to load the file. You may see a loading please wait indicator.
Once loading is complete, the dropdown list should contain the scenes and prefabs that are contained in the assetbundle file.
You can select which one you want to use. After selection, the object should appear in the scene.
Make sure you have a light source in the scene or you might not be able to see it.
Several excellent tutorials exist within the VaMHub database.
One of the best is by MacGruber, it includes a prebuilt project, assets and a detailed PDF that walks you through the entire process.
Unity AssetBundles for VaM
Hazmhox also has an excellent guide.
The definitive asset creation tutorial for VaM
VamTastic wrote Creating Prefabs in Unity.
Zgock resource: How to Make AutoFollowed and SpringBoned CUA Hair with CUAAutoFollow and EZSoftBone
Advanced: Installing Unity and the AssetBundle Browser from scratch:
The version of Unity that is compatible with VaM assetbundles is version 2018.1.9f1. You can download this version from here.
Save the exe into a local folder and then install Unity into a convenient location. If you don’t already have it installed you can also install the Unity Hub which is available here.
It should now show up in your list of installs.
Installing Asset Bundle Browser
Next you will need to install the Asset Bundle Browser which is available for free. Go to Window / Package Manager.
Add AssetBundles window to your Unity UI. Window->AssetBundle Browser. Drag it somewhere you prefer.
Unity Settings
- Set project Color Space to Linear to get proper lighting. This is found in Edit->Project Settings->Player. Then click Other Settings tab. Set Color Space->Linear (default is Gamma)
- Turn on VR support and set to single pass. This is found in Edit->Project Settings->Player. Then click XR Settings tab. Click Virtual Reality Support checkbox. The set Stereo Rendering Method->Single Pass.Install
CUA Full Scene Method
- delete any cameras in the scene
- (advised, but not 100% necessary): disable any light sources in the scene as you can add lights in VaM to dynamically light the objects. If you leave lights in, they will not be movable in VaM.
- save Unity scene
- find the Unity scene in the Project window. Click on the Configure tab in the AssetBundles window. Drag the Unity scene into the AssetBundles window left pane. The scene should appear in the list.
- Click on the Build tab in AssetBundles window. Select Build Target->Standalone Windows 64
- If you want to skip the copy + rename steps each time you rebuild, change the Output Path directory to the VaM Custom\Assets directory, and make all your assetbundles under a variant named "assetbundle" to make unity name them correctly.
- Click the 'Build' button. It could take some time to build depending on size of scene/asset.
- Open a windows file explorer outside of Unity. Browse to your Unity project directory and then into AssetBundles->StandaloneWindows64. Inside there you should see a file named the same as you scene. Copy this file into your VaM install area. Suggested to place into Custom\Assets (Saves\Assets for versions prior to 1.18) directory as this is where CustomUnityAsset looks for files by default.
- Rename the copy file to add .assetbundle on the end
- you should now be able to select this assetbundle file in the CustomUnityAsset atom file browser
- after selecting the file, you must wait for it to load, and then your scene should appear in the dropdown. Once you select in dropdown it should load into the scene and be visible. Make sure you have a light source or it might not be visible!
CUA Adding a DLL to load with the asset or environment
- Create a new .NET C# Class Library solution. ** Make sure to target .NET Framework 3.5 ** Ensure that the DLL compiled will have the same base name as your assetbundle! (this can be changed in Visual Studio using the project properties -> "assembly name")
- Add a reference to "UnityEngine.dll"
- note that the DLL built will not be able to reference VaM-specific objects, like Atom if you want it to show up in the Unity Editor (which you do).
- Create your MonoBehaviour derived scripts and compile.
- Add the DLL to the Assets in Unity and attach your scripts wherever.
- Export assetbundle as described above (do not include the DLL at this step)
- Copy the .assetbundle and .dll files (which should have the same name, because of step 1, right?) to <Vam>/Custom/Assets ** They must both be in the same directory, with the same base name. ** e.g. sample.dll will only be loaded with sample.assetbundle if they're in the same directory
The DLL should now load with the asset and your scripts should function as expected.