I was trying VAMMoan on a single character since the beginning of the dev. Yesterday I tried to add it to two characters, and I run into an issue.
When the scene loads, or I try to swap to an assetbundle that is already loaded by the other character, I get an error message saying that the assetbundle is not valid.
So I traced my loading system :
I tried to investigate and check a few plugins here and there. MacGruber as somewhat the same thing in Life, so as I did in my plugin I tried to trace the way stuffs are loaded like mine :
I know that the assetbundle loader locks the file. But since I'm using two different bundles in my case, that seems strange. Also, in the case of Life, the assetbundle is the same, and the problem doesn't happen... so I think I'm missing something here.
Is there some kind of parameters to send to the assetbundle loader to allow loading of multiple bundles ? What could produce that especially on two different files. Especially since the assetbundle loads perfectly when there's only one character.
The logic behind the loading system is simple :
HALP ! :]
When the scene loads, or I try to swap to an assetbundle that is already loaded by the other character, I get an error message saying that the assetbundle is not valid.
Code:
Error during attempt to load assetbundle Custom/Scripts/VAMMoan/audio/Isabella/voice.voicebundle. Not valid
So I traced my loading system :
Girl1 - Grace
Girl1 - Starting load request Custom/Scripts/VAMMoan/audio/Grace/voice.voicebundle
Girl2 - Isabella
Girl2 - Starting load request Custom/Scripts/VAMMoan/audio/Isabella/voice.voicebundle
Girl1 - Load request completed Custom/Scripts/VAMMoan/audio/Grace/voice.voicebundle
Error during attempt to load assetbundle Custom/Scripts/VAMMoan/audio/Isabella/voice.voicebundle. Not valid
I tried to investigate and check a few plugins here and there. MacGruber as somewhat the same thing in Life, so as I did in my plugin I tried to trace the way stuffs are loaded like mine :
Loading startedGirl1
Loading startedGirl2
Loading endedGirl1
Loading endedGirl2
I know that the assetbundle loader locks the file. But since I'm using two different bundles in my case, that seems strange. Also, in the case of Life, the assetbundle is the same, and the problem doesn't happen... so I think I'm missing something here.
Is there some kind of parameters to send to the assetbundle loader to allow loading of multiple bundles ? What could produce that especially on two different files. Especially since the assetbundle loads perfectly when there's only one character.
The logic behind the loading system is simple :
C#:
void LoadAudio()
{
try
{
logDebug("Starting load request " + voicePath + "/" + this.voiceBundleName);
// Loading the bundle for the current selected voice
Request request = new AssetLoader.AssetBundleFromFileRequest {path = voicePath + "/" + this.voiceBundleName, callback = OnVoiceBundleLoaded};
AssetLoader.QueueLoadAssetBundleFromFile(request);
// Loading the shared bundle used by all voices
Request requestShared = new AssetLoader.AssetBundleFromFileRequest {path = rootPath + "/voice-shared.voicebundle", callback = OnVoiceBundleSharedLoaded};
AssetLoader.QueueLoadAssetBundleFromFile(requestShared);
}
catch(Exception e)
{
Debug.LogWarning(e);
}
}
private void OnVoiceBundleLoaded(Request aRequest) {
voiceBundleRequest = aRequest;
List<string> audioPaths = GetAudioPaths();
foreach( string adPath in audioPaths ) {
AudioClip ac = voiceBundleRequest.assetBundle.LoadAsset<AudioClip>(adPath);
if( ac == null ) {
SuperController.LogError("VAMMoan : Voice sample not found (" + adPath + ").");
}
audioClips.Add(ac);
}
logDebug("Load request completed " + voicePath + "/" + this.voiceBundleName);
}
private void OnVoiceBundleSharedLoaded(Request aRequest) {
voiceSharedBundleRequest = aRequest;
List<string> sharedAudioPaths = GetSharedAudioPaths();
foreach( string sadPath in sharedAudioPaths ) {
AudioClip ac = voiceSharedBundleRequest.assetBundle.LoadAsset<AudioClip>(sadPath);
if( ac == null ) {
SuperController.LogError("VAMMoan : Shared voice sample not found (" + sadPath + ").");
}
sharedAudioClips.Add(ac);
}
}
HALP ! :]