- If you like this resource, consider liking and reviewing it for the community
- Take your time to read. I will not answer private messages asking questions about things that are actually explained in the tutorial.
VaM helps you to easily download and use content from the hub. But it hardly helps you to understand how to update your scenes properly when you are a creator.
This issue has been discussed several times about different plugins in the forums, discussions or discord, but has never been documented properly. Time to change that!
There are several methods to update plugins and .var references in your scene. I'm gonna list them all even if there is for me, only a single one worth using.
This is an adaptation of the technics explained in VAMMoan's documentation.
Best : Update method 1
Download the new version of your var file. Open your package manager, delete (all) previous versions of the resource. Either use hard reset, rescan packages with the package manager or restart VaM. ( I prefer using hard reset)
Load your scene, and resave it. VaM will automatically use the latest version of the resource, so you'll need to resave it if you want to publish it on the hub at some point.
Important: this method accounts for a resource properly done and updated trying to keep legacy features and everything working at every update. If the original creator breaks legacy features during an update, there is no guarantee that you scene will work like the original.
Still VaM always tries to update to any available version (if an older does not exists, it will grab the most recent one).
In a situation where you want to keep the old scenes with the legacy version, but update your new wip scene to the newest version:
Exit VaM (or do not start it). Delete all previous versions of the resource to the bin, or move them in another folder. Start VaM, open your new scene (which will update automatically to the latest version), save the scene. Restore your files from the bin or move them back to the AddonPackages folder. Restart VaM or use hard reset.
Update method 2
You will need to open the JSON files of your scenes (for instance with Notepad++).
Open your scene files, and search for "creatorname.ressourcename.
If you know the exact version you can search for "creatorname.resourcename.version:/
If we take VAMMoan as an example, it would be "hazmhox.vammoan.22:/
Replace every instance with the new version. For instance :
"hazmhox.vammoan.13:/ becomes "hazmhox.vammoan.15:/
Launch VaM and load your scene.
Update method 3
Load your scene.
Remove all instances of your resource (remove plugins, assetbundles, atoms).
Add your new version of your resource to your atoms. Do not add new version before removing all older instances.
Fix the dreaded invalid assetbundle error
You know... the usual error. THAT error:
This error happens when you try to load different versions of the same assetbundle in a scene. This phenomenon occurs because it is possible to have different var files, containing the same file.
Var files are simply zip files "mirroring" the folder structure of VaM.
If you have VAMMoan version 13 and version 22 on your install, you have two versions of the same file with this path: \Custom\Scripts\VAMMoan\audio\voices.voicebundle
This is where it gets impossible for Unity: If you try to load both version in a scene, Unity does not understand how to use them. They are somehow the same file, with the same path, with some identical content and some new content. In memory, it makes no sense, and the bundle fails to load.
And when this error occurs, VaM is stuck in a situation where the assetbundle is stuck and memory and you can't use or reload the plugin, you have to hard reset.
To avoid that situation, it is best to use the first update method. You will never ever encounter it if you do that.
But if you want to make some manual updates in a scene. You should never ever load the same assetbundle from two different version of the same resource.
This is true for simple assetbundles you load on a Custom Unity Asset Atom. But it is also true for automatically loaded assetbundle by plugins.
The rule of thumb to avoid any issue is then: never ever use different versions of a same resource in a scene.
If by any mistake, you load the wrong version and end up having the error. To fix it without restarting VaM you can use hard reset and reload your scene.
If anything seems unclear, don't hesitate to ask me to improve. But to summarize the tutorial:
- Use Update Method 1
- Favour keeping only the last version of a resource in general (especially for plugins)
- Never use two different versions of a resource in a scene