private void LoadSoundtrack() { if (pathToSoundtrackFileWithinResourcesFolder == null || pathToSoundtrackFileWithinResourcesFolder.Length == 0) { Debug.LogError("No path to psai soundtrack file set!"); } else { PsaiResult psaiResult = PsaiResult.error_file; if (pathToSoundtrackFileWithinResourcesFolder.EndsWith(".xml")) { psaiResult = PsaiCore.Instance.LoadSoundtrackFromProjectFile(pathToSoundtrackFileWithinResourcesFolder); } #if (PSAI_BUILT_BY_VS || PSAI_STANDALONE || PSAI_EDITOR_STANDALONE) else if (pathToSoundtrackFileWithinResourcesFolder.EndsWith(".bytes")) { Debug.LogWarning("Binary psai soundtrack files are deprecated! Instead, you can now load psai Project files directly by xml. To do so, rename your 'MyProject.psai' file to 'MyProject.xml' . Please make sure that there is no 'MyProject.bytes' or 'MyProject.psai' file in the same directory, as this might cause problems at runtime due to Unity ignoring file extensions."); psaiResult = PsaiCore.Instance.LoadSoundtrack(pathToSoundtrackFileWithinResourcesFolder); } #endif if (psaiResult != PsaiResult.OK) { Debug.LogError("Failed to load psai soundtrack from path '" + pathToSoundtrackFileWithinResourcesFolder + "' Please make sure the file is located within your Assets/Resources/ folder. [" + PsaiCore.Instance.GetVersion() + "]"); } } }
void Start() { if (PathToSoundtrackFileWithinResourcesFolder == null || PathToSoundtrackFileWithinResourcesFolder.Length == 0) { Debug.LogError("No path to psai soundtrack file set!"); } else { PsaiResult psaiResult = PsaiCore.Instance.LoadSoundtrackFromProjectFile(PathToSoundtrackFileWithinResourcesFolder); if (psaiResult != PsaiResult.OK) { Debug.LogError("Failed to load psai soundtrack from path '" + PathToSoundtrackFileWithinResourcesFolder + "' Please make sure the file is located within your Assets/Resources/ folder. [ psai Version: " + PsaiCore.Instance.GetVersion() + "]"); } } }
void PsaiErrorCheck(PsaiResult result, string infoAboutLastCall) { if (result != PsaiResult.OK) { StringBuilder sb = new StringBuilder(); sb.AppendLine("PSAI error!"); sb.AppendLine(infoAboutLastCall); sb.Append("PsaiResult="); sb.Append(result); Logger.Instance.Log(sb.ToString(), LogLevel.errors); } }