public GameObject Load3DObject(ModBehaviour modBehaviour, string objectFilename, string imageFilename) { var objectPath = modBehaviour.ModManifest.FolderPath + objectFilename; var imagePath = modBehaviour.ModManifest.FolderPath + imageFilename; _console.WriteLine("Loading object from " + objectPath); var go = new GameObject(); go.AddComponent <DontDestroyOnLoad>(); modBehaviour.StartCoroutine(LoadMesh(go, objectPath)); modBehaviour.StartCoroutine(LoadTexture(go, imagePath)); return(go); }
public AudioSource LoadAudio(ModBehaviour modBehaviour, string audioFilename) { var audioPath = modBehaviour.ModManifest.FolderPath + audioFilename; _console.WriteLine("Loading audio from " + audioPath); var go = new GameObject(); go.AddComponent <DontDestroyOnLoad>(); var audioSource = go.AddComponent <AudioSource>(); modBehaviour.StartCoroutine(LoadAudioClip(audioSource, audioPath)); return(audioSource); }