Show / Hide Table of Contents

Class IntroloopPlayer<T>

An abstract class that grants you a new set of convenient singleton instance just like the Instance, but now under your own self-defined class name. (e.g. You can now call MyIntroloopPlayer.Instance and so on.)

Inheritance
System.Object
UnityEngine.Object
UnityEngine.Component
UnityEngine.Behaviour
UnityEngine.MonoBehaviour
IntroloopPlayer
IntroloopPlayer<T>
Inherited Members
IntroloopPlayer.DefaultIntroloopAudio
IntroloopPlayer.PlayOnAwake
IntroloopPlayer.TemplateSource
IntroloopPlayer.InternalAudioSources
IntroloopPlayer.OnApplicationPause(Boolean)
IntroloopPlayer.Play(Single, Single)
IntroloopPlayer.Play(IntroloopAudio, Single, Single)
IntroloopPlayer.Play(IntroloopAudio)
IntroloopPlayer.Play()
IntroloopPlayer.Seek(Single)
IntroloopPlayer.Stop()
IntroloopPlayer.Stop(Single)
IntroloopPlayer.Pause()
IntroloopPlayer.Pause(Single)
IntroloopPlayer.Resume(Single)
IntroloopPlayer.Preload(IntroloopAudio)
IntroloopPlayer.GetPlayheadTime()
IntroloopPlayer.SetMixerGroup(AudioMixerGroup)
IntroloopPlayer.ApplyAudioSource(AudioSource)
IntroloopPlayer.GetDebugStringsTrack1()
IntroloopPlayer.GetDebugStringsTrack2()
Namespace: E7.Introloop
Assembly: E7.Introloop.dll
Syntax
public abstract class IntroloopPlayer<T> : IntroloopPlayer where T : IntroloopPlayer
Type Parameters
Name Description
T
Remarks

This class utilize C# trick where each unique combination of generic class gives you a unique instance of static variables. Putting your self-defined class itself inside T basically give you a personal set of static.

Define your class like this :

public class FieldBGMPlayer : IntroloopPlayer<FieldBGMPlayer>
(Put your class itself into the generic variable.)

Properties

Instance

Get a convenient singleton instance of from anywhere in your code. This singleton instant is different for each subclass of this abstract class. It has DontDestroyOnLoad applied.

Before calling this for the first time, call SetSingletonInstanceTemplateSource(AudioSource) first to setup its TemplateSource from script. (It does not exist until runtime, you cannot setup the template ahead of time unlike non-singleton instances.)

Declaration
public static T Instance { get; }
Property Value
Type Description
T

Methods

SetSingletonInstanceTemplateSource(AudioSource)

Call this before the first use of Instance to have the singleton instance copy UnityEngine.AudioSource fields from templateSource.

Declaration
public static void SetSingletonInstanceTemplateSource(AudioSource templateSource)
Parameters
Type Name Description
UnityEngine.AudioSource templateSource
Remarks

Singleton instance is convenient but you cannot pre-connect TemplateSource like a regular instance because it does not exist until runtime.

If you had already used the singleton instance before calling this, you can still call ApplyAudioSource(AudioSource) on the singleton instance to apply different settings of UnityEngine.AudioSource.

In This Article
Back to top
A Unity plugin by 5argon from Exceed7 Experiments. Problems/suggestions/contact : 5argon@exceed7.com Discord Unity Forum