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

Definition at line 32 of file Singleton.cs.

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