Tilt Five™ Unity API  1.4.1
TiltFive.TiltFiveSingletonHelper Class Reference

Static Public Member Functions

static ISceneInfo GetISceneInfo ()
 
static bool TryGetISceneInfo (out ISceneInfo sceneInfo)
 

Detailed Description

Definition at line 31 of file TiltFiveSingletonHelper.cs.

Member Function Documentation

◆ GetISceneInfo()

static ISceneInfo TiltFive.TiltFiveSingletonHelper.GetISceneInfo ( )
static

Definition at line 33 of file TiltFiveSingletonHelper.cs.

34  {
35  TryGetISceneInfo(out var singleplayerSingleton);
36  return singleplayerSingleton;
37  }
static bool TryGetISceneInfo(out ISceneInfo sceneInfo)

References TiltFive.TiltFiveSingletonHelper.TryGetISceneInfo().

◆ TryGetISceneInfo()

static bool TiltFive.TiltFiveSingletonHelper.TryGetISceneInfo ( out ISceneInfo  sceneInfo)
static

Definition at line 39 of file TiltFiveSingletonHelper.cs.

40  {
41  if (TiltFiveManager2.IsInstantiated)
42  {
43  sceneInfo = TiltFiveManager2.Instance;
44  return true;
45  }
46 
47  if (TiltFiveManager.IsInstantiated)
48  {
49  sceneInfo = TiltFiveManager.Instance;
50  return true;
51  }
52 
53  // The TiltFiveManager2 or TiltFiveManager won't appear to be instantiated
54  // until their Awake() functions are called. If we're calling from the editor
55  // outside of play mode, just scan the scene.
56  // Presumably this is being called from a menu script, gizmo, etc.
57  if (!Application.isPlaying)
58  {
59  var tiltFiveManager2 = GameObject.FindObjectOfType<TiltFiveManager2>();
60  if (tiltFiveManager2 != null)
61  {
62  sceneInfo = tiltFiveManager2;
63  return true;
64  }
65 
66  var tiltFiveManager = GameObject.FindObjectOfType<TiltFiveManager>();
67  if (tiltFiveManager != null)
68  {
69  sceneInfo = tiltFiveManager;
70  return true;
71  }
72  }
73 
74  sceneInfo = null;
75  return false;
76  }

References TiltFive.SingletonComponent< T >.Instance.

Referenced by TiltFive.TiltFiveSingletonHelper.GetISceneInfo(), TiltFive.Player.TryGetSettings(), and TiltFive.Glasses.TryGetSpectatorSettings().


The documentation for this class was generated from the following file: