Tanoda
AppGlobals.cs
Go to the documentation of this file.
1
/******************************************************************************
2
* Copyright (C) Ultraleap, Inc. 2011-2020. *
3
* *
4
* Use subject to the terms of the Apache License 2.0 available at *
5
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement *
6
* between Ultraleap and you, your company or other organization. *
7
******************************************************************************/
8
9
using
UnityEngine
;
10
11
namespace
Leap.Unity
{
12
13
public
class
AppGlobals
<T> : MonoBehaviour where T :
AppGlobals
<T> {
14
15
protected
void
Awake
() {
16
if
(s_instance !=
null
) {
17
Debug
.LogWarning(
"Multiple instances of "
+ typeof(T) +
" detected. "
+
18
"AppGlobals are supposed to be singletons; the instance that awakens the "
+
19
"latest will be the ultimate receiver of static instance calls."
);
20
}
21
s_instance =
this
as T;
22
}
23
24
private
static
T s_instance =
null
;
25
public
static
T
instance
{
26
get
{
27
if
(s_instance ==
null
) {
28
s_instance = FindObjectOfType<T>();
29
}
30
if
(s_instance ==
null
) {
31
Debug
.LogError(
"No "
+ typeof(T) +
" instance found. App "
+
32
"instances are loaded lazily from the Scene hierarchy when first "
+
33
"requested; did you forget to add a "
+ typeof(T) +
" to "
+
34
"the scene?"
);
35
}
36
return
s_instance;
37
}
38
}
39
40
}
41
42
}
Debug
UnityEngine.Debug Debug
Definition:
TanodaServer.cs:19
Leap.Unity.AppGlobals
Definition:
AppGlobals.cs:13
Leap.Unity.AppGlobals.instance
static T? instance
Definition:
AppGlobals.cs:25
Leap.Unity.AppGlobals.Awake
void Awake()
Definition:
AppGlobals.cs:15
Leap.Unity
Definition:
AssetFolderPropertyDrawer.cs:15
UnityEngine
Definition:
HSVPicker/UtilityScripts/BoxSlider.cs:7
Source
Assets
Plugins
LeapMotion
Core
Scripts
Utils
AppGlobals.cs
Generated by
1.9.3