1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
|
C++RAW
#include "UnityPrefix.h"
#include "Configuration/UnityConfigure.h"
#include "Runtime/Scripting/ScriptingUtility.h"
#include "Runtime/Mono/MonoBehaviour.h"
#include "Runtime/Scripting/DelayedCallUtility.h"
using namespace Unity;
using namespace std;
CSRAW
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Collections;
using UnityEngineInternal;
namespace UnityEngine
{
// MonoBehaviour is the base class every script derives from.
CSRAW
NONSEALED_CLASS MonoBehaviour : Behaviour
//*undocumented*
THREAD_SAFE
CONDITIONAL !UNITY_FLASH && !UNITY_WEBGL && !UNITY_WINRT
CUSTOM public MonoBehaviour ()
{
#if UNITY_EDITOR
if (self.GetInstanceID() == 0)
{
ScriptWarning ("You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. MonoBehaviours can only be added using AddComponent(). Alternatively, your script can inherit from ScriptableObject or no base class at all", NULL);
}
#endif
}
// Update is called every frame, if the MonoBehaviour is enabled.
CSNONE void Update ();
// LateUpdate is called every frame, if the [[Behaviour]] is enabled.
CSNONE void LateUpdate ();
// This function is called every fixed framerate frame, if the MonoBehaviour is enabled.
CSNONE void FixedUpdate ();
// Awake is called when the script instance is being loaded.
CSNONE void Awake ();
// Start is called just before any of the Update methods is called the first time.
CSNONE void Start ();
// Reset to default values.
CSNONE void Reset ();
// OnMouseEnter is called when the mouse entered the [[GUIElement]] or [[Collider]].
CSNONE void OnMouseEnter ();
// OnMouseOver is called every frame while the mouse is over the [[GUIElement]] or [[Collider]].
CSNONE void OnMouseOver ();
// OnMouseExit is called when the mouse is not any longer over the [[GUIElement]] or [[Collider]].
CSNONE void OnMouseExit ();
// OnMouseDown is called when the user has pressed the mouse button while over the [[GUIElement]] or [[Collider]].
CSNONE void OnMouseDown ();
// OnMouseUp is called when the user has released the mouse button.
CSNONE void OnMouseUp ();
// OnMouseUpAsButton is only called when the mouse is released over the same [[GUIElement]] or [[Collider]] as it was pressed.
CSNONE void OnMouseUpAsButton ();
// OnMouseDrag is called when the user has clicked on a [[GUIElement]] or [[Collider]] and is still holding down the mouse.
CSNONE void OnMouseDrag ();
// OnTriggerEnter is called when the [[Collider]] /other/ enters the [[class-BoxCollider|trigger]].
CSNONE void OnTriggerEnter (Collider other);
// OnTriggerExit is called when the [[Collider]] /other/ has stopped touching the [[class-BoxCollider|trigger]].
CSNONE void OnTriggerExit (Collider other);
// OnTriggerStay is called once per frame for every [[Collider]] /other/ that is touching the [[class-BoxCollider|trigger]].
CSNONE void OnTriggerStay (Collider other);
// OnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider.
CSNONE void OnCollisionEnter (Collision collisionInfo);
// OnCollisionExit is called when this collider/rigidbody has stopped touching another rigidbody/collider.
CSNONE void OnCollisionExit (Collision collisionInfo);
// OnCollisionStay is called once per frame for every collider/rigidbody that is touching rigidbody/collider.
CSNONE void OnCollisionStay (Collision collisionInfo);
// OnControllerColliderHit is called when the controller hits a collider while performing a Move.
CSNONE void OnControllerColliderHit (ControllerColliderHit hit);
// Called when a joint attached to the same game object broke.
CSNONE void OnJointBreak (float breakForce);
#if ENABLE_2D_PHYSICS
// OnCollisionEnter2D is called when this [[Collider2D]] has begun touching another [[Collider2D]].
CSNONE void OnCollisionEnter2D (Collision2D info);
// OnCollisionStay2D is called once per frame for this [[Collider2D]] if it is continuing to touch another [[Collider2D]].
CSNONE void OnCollisionStay2D (Collision2D info);
// OnCollisionExit2D is called when this [[Collider2D]] has stopped touching another [[Collider2D]].
CSNONE void OnCollisionExit2D (Collision2D info);
// OnTriggerEnter2D is called when a [[Collider2D]] has begun touching another [[Collider2D]] configured as a trigger.
CSNONE void OnTriggerEnter2D (Collider2D other);
// OnTriggerStay2D is called once per frame for a [[Collider2D]] if it is continuing to touch another [[Collider2D]] configured as a trigger.
CSNONE void OnTriggerStay2D (Collider2D other);
// OnTriggerExit2D is called when a [[Collider2D]] has stopped touching another [[Collider2D]] configured as a trigger.
CSNONE void OnTriggerExit2D (Collider2D other);
#endif
// OnParticleCollision is called when a particle hits a collider (legacy particle system only).
CSNONE void OnParticleCollision (GameObject other);
// OnBecameVisible is called when the renderer became visible by any camera.
CSNONE void OnBecameVisible();
// OnBecameInvisible is called when the renderer is no longer visible by any camera.
CSNONE void OnBecameInvisible();
// This function is called after a new level was loaded.
CSNONE void OnLevelWasLoaded (int level);
// This function is called when the object becomes enabled and active.
CSNONE void OnEnable ();
// This function is called when the behaviour becomes disabled () or inactive.
CSNONE void OnDisable();
// This function is called when the script is loaded or a value is changed in the inspector, use it to validate your data.
CSNONE void OnValidate ();
// This function is called when the MonoBehaviour will be destroyed.
CSNONE void OnDestroy();
// OnPreCull is called before a camera culls the scene.
CSNONE void OnPreCull ();
// OnPreRender is called before a camera starts rendering the scene.
CSNONE void OnPreRender ();
// OnPostRender is called after a camera finished rendering the scene.
CSNONE void OnPostRender ();
// OnRenderObject is called after camera has rendered the scene.
CSNONE void OnRenderObject ();
// OnWillRenderObject is called once for each camera if the object is visible.
CSNONE void OnWillRenderObject ();
// OnGUI is called for rendering and handling GUI events.
CSNONE void OnGUI ();
// OnRenderImage is called after all rendering is complete to render image
CSNONE void OnRenderImage (RenderTexture source, RenderTexture destination);
// Implement this OnDrawGizmosSelected if you want to draw gizmos only if the object is selected.
CSNONE void OnDrawGizmosSelected ();
// Implement this OnDrawGizmos if you want to draw gizmos that are also pickable and always drawn.
CSNONE void OnDrawGizmos ();
// Sent to all game objects when the player pauses.
CSNONE void OnApplicationPause(bool pause);
// Sent to all game objects when the player gets or loses focus.
CSNONE void OnApplicationFocus(bool focus);
// Sent to all game objects before the application is quit.
CSNONE void OnApplicationQuit ();
// Called on the server whenever a new player has successfully connected.
CSNONE void OnPlayerConnected (NetworkPlayer player);
// Called on the server whenever a Network.InitializeServer was invoked and has completed.
CSNONE void OnServerInitialized ();
// Called on the client when you have successfully connected to a server
CSNONE void OnConnectedToServer ();
// Called on the server whenever a player disconnected from the server.
CSNONE void OnPlayerDisconnected (NetworkPlayer player);
// Called on the client when the connection was lost or you disconnected from the server.
CSNONE void OnDisconnectedFromServer (NetworkDisconnection mode);
// Called on the client when a connection attempt fails for some reason.
CSNONE void OnFailedToConnect (NetworkConnectionError error);
// Called on clients or servers when there is a problem connecting to the MasterServer.
CSNONE void OnFailedToConnectToMasterServer (NetworkConnectionError error);
// Called on clients or servers when reporting events from the MasterServer.
CSNONE void OnMasterServerEvent (MasterServerEvent msEvent);
// Called on objects which have been network instantiated with Network.Instantiate
CSNONE void OnNetworkInstantiate (NetworkMessageInfo info);
// Used to customize synchronization of variables in a script watched by a network view.
CSNONE void OnSerializeNetworkView (BitStream stream, NetworkMessageInfo info);
// If OnAudioFilterRead is implemented, Unity will insert a custom filter into the audio DSP chain.
CSNONE void OnAudioFilterRead ();
// Callback for processing animation movements for modifying root motion.
CSNONE void OnAnimatorMove ();
// Callback for setting up animation IK (inverse kinematics)
CSNONE void OnAnimatorIK (int layerIndex);
CUSTOM private void Internal_CancelInvokeAll ()
{
CancelInvoke (*self);
}
CUSTOM private bool Internal_IsInvokingAll ()
{
return IsInvoking (*self);
}
// Invokes the method /methodName/ in time seconds.
CUSTOM void Invoke (string methodName, float time)
{
InvokeDelayed (*self, methodName, time, 0.0F);
}
// Invokes the method /methodName/ in /time/ seconds.
CUSTOM void InvokeRepeating (string methodName, float time, float repeatRate)
{
InvokeDelayed (*self, methodName, time, repeatRate);
}
// Cancels all Invoke calls on this MonoBehaviour.
CSRAW public void CancelInvoke ()
{
Internal_CancelInvokeAll ();
}
// Cancels all Invoke calls with name /methodName/ on this behaviour.
CUSTOM void CancelInvoke (string methodName) { CancelInvoke (*self, methodName); }
// Is any invoke on /methodName/ pending?
CUSTOM bool IsInvoking (string methodName) { return IsInvoking (*self, methodName); }
// Is any invoke pending on this MonoBehaviour?
CSRAW public bool IsInvoking ()
{
return Internal_IsInvokingAll ();
}
// Starts a coroutine.
CSRAW public Coroutine StartCoroutine (IEnumerator routine)
{
return StartCoroutine_Auto(routine);
}
//*undocumented*
CUSTOM Coroutine StartCoroutine_Auto (IEnumerator routine)
{
Scripting::RaiseIfNull(routine);
if (!self->IsInstanceIDCreated () || !self->IsDerivedFrom (ClassID (MonoBehaviour)))
Scripting::RaiseArgumentException ("Coroutines can only be started from a MonoBehaviour");
return self->StartCoroutineManaged2(routine);
}
// Starts a coroutine named /methodName/.
CUSTOM Coroutine StartCoroutine (string methodName, object value = null)
{
Scripting::RaiseIfNull((void*)(!methodName.IsNull()));
if (!self->IsInstanceIDCreated () || !self->IsDerivedFrom (ClassID (MonoBehaviour)))
Scripting::RaiseArgumentException ("Coroutines can only be started from a MonoBehaviour");
char* cString = ScriptingStringToAllocatedChars (methodName);
ScriptingObjectPtr coroutine = self->StartCoroutineManaged (cString, value);
ScriptingStringToAllocatedChars_Free (cString);
return coroutine;
}
// Stops all coroutines named /methodName/ running on this behaviour.
CUSTOM void StopCoroutine (string methodName) { self->StopCoroutine(methodName.AsUTF8().c_str()); }
// Stops all coroutines running on this behaviour.
CUSTOM void StopAllCoroutines () { self->StopAllCoroutines(); }
// Logs message to the Unity Console. This function is identical to [[Debug.Log]].
CSRAW public static void print (object message)
{
Debug.Log (message);
}
// Disabling this lets you skip the GUI layout phase.
CONDITIONAL !UNITY_WEBGL
AUTO_PROP bool useGUILayout GetUseGUILayout SetUseGUILayout
CSRAW #if UNITY_WINRT
CSRAW private static FastCallExceptionHandler _fastCallExceptionHandler;
CSRAW internal static void SetupFastCallExceptionHandler(FastCallExceptionHandler handler)
{
_fastCallExceptionHandler = handler;
}
CSRAW protected static void HandleFastCallException(Exception ex)
{
if (_fastCallExceptionHandler != null)
_fastCallExceptionHandler(ex);
else throw ex;
}
CSRAW #endif
END
CSRAW }
|