VR Development Framework
v 1.0.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
void AVR.Core.AVR_SingletonComponent< T >.SetInstance ( )
inlineprivate

Definition at line 31 of file AVR_SingletonComponent.cs.

31  {
32  if (_Instance != null)
33  {
34  AVR_DevConsole.cwarn(this.name + " is marked as Singleton but another instance was found in the scene. Continuing to use old one.", this);
35  return;
36  }
37 
38  Instance = gameObject.GetComponent<T>();
39 
40  if (Instance == null)
41  {
42  AVR_DevConsole.cerror(this.name + " is marked as a Singleton of type " + typeof(T).ToString() + " but no component of this type was found!", this);
43  }
44 
45  DontDestroyOnLoad(this);
46  }