summaryrefslogtreecommitdiff
path: root/Runtime/Export/BaseClass.txt
blob: f083ca0244188ea8f137e073763ba4847c8fa214 (plain)
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
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
C++RAW


#include "UnityPrefix.h"
#include "Configuration/UnityConfigure.h"
#include "Runtime/Mono/MonoManager.h"
#include "Runtime/Graphics/Transform.h"
#include "Runtime/Utilities/PathNameUtility.h"
#include "Runtime/Input/InputManager.h"
#include "Runtime/Input/TimeManager.h"
#include "Runtime/Misc/ResourceManager.h"
#include "Runtime/Profiler/ProfilerImpl.h"
#include "Runtime/Mono/MonoBehaviour.h"
#include "Runtime/BaseClasses/Tags.h"
#include "Runtime/Misc/DebugUtility.h"
#include "Runtime/Misc/PlayerSettings.h"
#include "Runtime/GameCode/CloneObject.h"
#include "Runtime/Math/Random/Random.h"
#include "Runtime/Misc/PreloadManager.h"
#include "Runtime/Allocator/MemoryManager.h"
#include "Runtime/Audio/AudioClip.h"
#if ENABLE_AUDIO
#include "Runtime/Audio/AudioSource.h"
#include "Runtime/Audio/AudioListener.h"
#include "Runtime/Audio/AudioManager.h"
#include "Runtime/Audio/AudioReverbZone.h"
#include "Runtime/Audio/AudioReverbFilter.h"
#include "Runtime/Audio/AudioHighPassFilter.h"
#include "Runtime/Audio/AudioLowPassFilter.h"
#include "Runtime/Audio/AudioChorusFilter.h"
#include "Runtime/Audio/AudioDistortionFilter.h"
#include "Runtime/Audio/AudioEchoFilter.h"
#endif
#include "Runtime/Animation/Animation.h"
#include "Runtime/Math/Color.h"
#include "Runtime/Utilities/PlayerPrefs.h"
#include "Runtime/Camera/Camera.h"
#include "Runtime/Dynamics/RigidBody.h"
#include "Runtime/Utilities/Word.h"
#include "Runtime/Camera/Light.h"
#include "Runtime/Filters/Misc/TextMesh.h"
#include "Runtime/Dynamics/ConstantForce.h"
#include "Runtime/Filters/Renderer.h"
#include "Runtime/Misc/SaveAndLoadHelper.h"
#include "Runtime/Network/NetworkView.h"
#include "Runtime/Network/NetworkManager.h"
#include "Runtime/Camera/RenderLayers/GUIText.h"
#include "Runtime/Camera/RenderLayers/GUITexture.h"
#include "Runtime/Dynamics/Collider.h"
#include "Runtime/Dynamics/HingeJoint.h"
#include "Runtime/Filters/Particles/ParticleEmitter.h"
#include "Runtime/Misc/Player.h"
#include "Runtime/BaseClasses/IsPlaying.h"
#include "Runtime/Misc/CaptureScreenshot.h"
#include "Runtime/Misc/GameObjectUtility.h"
#include "Runtime/Misc/Plugins.h"
#include "Runtime/Misc/ResourceManagerUtility.h"
#include "Runtime/Utilities/PathNameUtility.h"
#include "Runtime/Utilities/File.h"
#include <ctime>
#include "Runtime/Input/GetInput.h"
#include "Runtime/NavMesh/NavMeshAgent.h"
#include "Runtime/NavMesh/NavMesh.h"
#include "Runtime/NavMesh/OffMeshLink.h"
#include "Runtime/Misc/BuildSettings.h"
#include "Runtime/Animation/AnimationManager.h"
#include "Runtime/Animation/AnimationClip.h"
#include "Runtime/BaseClasses/RefCounted.h"
#include "Runtime/Misc/GOCreation.h"
#include "Runtime/Utilities/URLUtility.h"
#include "Runtime/Graphics/ScreenManager.h"
#include "Runtime/Serialize/PersistentManager.h"
#include "Runtime/Shaders/GraphicsCaps.h"
#include "Runtime/Misc/SystemInfo.h"
#include "Runtime/Utilities/FileUtilities.h"
#include "Runtime/Misc/GraphicsDevicesDB.h"
#include "Configuration/UnityConfigureVersion.h"
#include "Runtime/Profiler/CollectProfilerStats.h"
#include "Runtime/File/ApplicationSpecificPersistentDataPath.h"
#include "Runtime/Mono/Coroutine.h"
#include "Runtime/Scripting/Scripting.h"
#include "Runtime/Scripting/ScriptingUtility.h"
#include "Runtime/Scripting/ScriptingExportUtility.h"
#include "Runtime/Scripting/GetComponent.h"
#include "Runtime/Scripting/Backend/ScriptingBackendApi.h"
#include "Runtime/Scripting/Backend/ScriptingTypeRegistry.h"
#include "Runtime/Scripting/ScriptingObjectWithIntPtrField.h"

#if SUPPORT_REPRODUCE_LOG
#include "Runtime/Misc/ReproductionLog.h"
#endif

#if WEBPLUG
	#include "PlatformDependent/CommonWebPlugin/UnityWebStream.h"
	#include "PlatformDependent/CommonWebPlugin/WebScripting.h"
#endif

#if UNITY_EDITOR
	#include "Editor/Src/EditorSettings.h"
	#include "Editor/Src/EditorUserBuildSettings.h"
	#include "Editor/Mono/MonoEditorUtility.h"
#endif

#if UNITY_WII
	#include "PlatformDependent/Wii/WiiUtility.h"
#endif

using namespace Unity;

/*
   Mono defines a bool as either 1 or 2 bytes.
   On windows a bool on the C++ side needs to be 2 bytes.
   We use the typemap to map bool's to short's.
   When using the C++ keyword and you want to export a bool value
   to mono you have to use a short on the C++ side.
*/


void PauseEditor ();
using namespace std;

CSRAW
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Collections;
using System.Collections.Generic;
using UnityEngineInternal;

namespace UnityEngine
{

[StructLayout (LayoutKind.Sequential)]
internal struct ReferenceData
{
	public int instanceID;
	public IntPtr cachedPtr;
}

// Bit mask that controls object destruction and visibility in inspectors
CSRAW [Flags]
ENUM HideFlags
	// A normal, visible object. This is the default.
	None = 0,

	// The object will not appear in the hierarchy and will not show up in the project view if it is stored in an asset.
	HideInHierarchy = 1,

	// It is not possible to view it in the inspector
	HideInInspector = 2,

	// The object will not be saved to the scene. __It will not be destroyed when a new scene is loaded__.
	DontSave = 4,

	// The object is not be editable in the inspector
	NotEditable = 8,

	// A combination of not shown in the hierarchy and not saved to to scenes.
	HideAndDontSave = 13
END

// Options for how to send a message.
ENUM SendMessageOptions
	// A receiver is required for SendMessage.
	RequireReceiver = 0,

	// No receiver is required for SendMessage.
	DontRequireReceiver = 1
END

// The various primitives that can be created using the GameObject.CreatePrimitive function.
CSRAW
ENUM PrimitiveType
	// A sphere primitive
	Sphere = 0,

	// A capsule primitive
	Capsule = 1,

	// A cylinder primitive
	Cylinder = 2,

	// A cube primitive
	Cube = 3,

	// A plane primitive
	Plane = 4,

	// A quad primitive
	Quad = 5
END

// The coordinate space in which to operate.
ENUM Space
	// Applies transformation relative to the world coordinate system
	World = 0,
	// Applies transformation relative to the local coordinate system
	Self = 1
END



// LayerMask allow you to display the LayerMask popup menu in the inspector
STRUCT LayerMask
	CSRAW
	private int m_Mask;

	//*undocumented* TODO: make this actually work
	CSRAW public static implicit operator int (LayerMask mask) { return mask.m_Mask; }

	// implicitly converts an integer to a LayerMask
	public static implicit operator LayerMask (int intVal) { LayerMask mask; mask.m_Mask = intVal; return mask; }

	// Converts a layer mask value to an integer value.
	CSRAW public int value { get { return m_Mask; } set { m_Mask = value; } }

	// Given a layer number, returns the name of the layer as defined in either a Builtin or a User Layer in the [[wiki:class-TagManager|Tag Manager]]
	CUSTOM static string LayerToName (int layer) { return scripting_string_new(LayerToString(layer)); }

	// Given a layer name, returns the layer index as defined by either a Builtin or a User Layer in the [[wiki:class-TagManager|Tag Manager]]
	CUSTOM static int NameToLayer (string layerName) { return StringToLayer(layerName); }
END


// The platform application is running. Returned by Application.platform.
ENUM RuntimePlatform
	// In the Unity editor on Mac OS X.
	OSXEditor = 0,

	// In the player on Mac OS X.
	OSXPlayer = 1,

	// In the player on Windows.
	WindowsPlayer = 2,

	// In the web player on Mac OS X.
	OSXWebPlayer = 3,

	// In the Dashboard widget on Mac OS X.
	OSXDashboardPlayer = 4,

	// In the web player on Windows.
	WindowsWebPlayer = 5,

	// In the player on Nintendo Wii.
	WiiPlayer = 6,

	// In the Unity editor on Windows.
	WindowsEditor = 7,

	// In the player on the iPhone.
	IPhonePlayer = 8,

	// In the player on the XBOX360
	XBOX360 = 10,

	// In the player on the Play Station 3
	PS3 = 9,

	// In the player on Android devices.
	Android = 11,

	//Google Native Client
	NaCl = 12,

	//*undocumented*
	LinuxPlayer = 13,

	//Flash Player
	FlashPlayer = 15,

	//*undocumented*
	MetroPlayerX86 = 18,

	//*undocumented*
	MetroPlayerX64 = 19,

	//*undocumented*
	MetroPlayerARM = 20,

	//*undocumented*
	WP8Player = 21,

	//*undocumented*
	BB10Player = 22,

	//*undocumented*
	TizenPlayer = 23,

END

// The language the user's operating system is running in. Returned by Application.systemLanguage.
ENUM SystemLanguage
	//Afrikaans
	Afrikaans = 0,
	//Arabic
	Arabic = 1,
	//Basque
	Basque = 2,
	//Belarusian
	Belarusian = 3,
	//Bulgarian
	Bulgarian = 4,
	//Catalan
	Catalan = 5,
	//Chinese
	Chinese = 6,
	//Czech
	Czech = 7,
	//Danish
	Danish = 8,
	//Dutch
	Dutch = 9,
	//English
	English = 10,
	//Estonian
	Estonian = 11,
	//Faroese
	Faroese = 12,
	//Finnish
	Finnish = 13,
	//French
	French = 14,
	//German
	German = 15,
	//Greek
	Greek = 16,
	//Hebrew
	Hebrew = 17,
	//*undocumented*
	Hugarian = 18,
	//Icelandic
	Icelandic = 19,
	//Indonesian
	Indonesian = 20,
	//Italian
	Italian = 21,
	//Japanese
	Japanese = 22,
	//Korean
	Korean = 23,
	//Latvian
	Latvian = 24,
	//Lithuanian
	Lithuanian = 25,
	//Norwegian
	Norwegian = 26,
	//Polish
	Polish = 27,
	//Portuguese
	Portuguese = 28,
	//Romanian
	Romanian = 29,
	//Russian
	Russian = 30,
	//Serbo-Croatian
	SerboCroatian = 31,
	//Slovak
	Slovak = 32,
	//Slovenian
	Slovenian = 33,
	//Spanish
	Spanish = 34,
	//Swedish
	Swedish = 35,
	//Thai
	Thai = 36,
	//Turkish
	Turkish = 37,
	//Ukrainian
	Ukrainian = 38,
	//Vietnamese
	Vietnamese = 39,
	//Unknown
	Unknown = 40,
	//Hungarian
	Hungarian = 18
END

// The type of the log message in the delegate registered with Application.RegisterLogCallback.
ENUM LogType
	// LogType used for Errors.
    Error = 0,
    // LogType used for Asserts. (These indicate an error inside Unity itself.)
    Assert = 1,
    // LogType used for Warnings.
    Warning = 2,
    // LogType used for regular log messages.
    Log = 3,
    // LogType used for Exceptions.
    Exception = 4
END

// Enumeration for [[SystemInfo.deviceType]], denotes a coarse grouping of kinds of devices.
ENUM DeviceType
	// Device type is unknown. You should never see this in practice.
	Unknown = 0,

	// A handheld device like mobile phone or a tablet.
	Handheld = 1,

	// A stationary gaming console.
	Console = 2,

	// Desktop or laptop computer.
	Desktop = 3,
END

// Access system information.
CLASS SystemInfo

	// Operating system name with version (RO).
	CUSTOM_PROP static string operatingSystem { return scripting_string_new( systeminfo::GetOperatingSystem() ); }

	// Processor name (RO).
	CUSTOM_PROP static string processorType { return scripting_string_new( systeminfo::GetProcessorType() ); }

	// Number of processors present (RO).
	CUSTOM_PROP static int processorCount { return systeminfo::GetProcessorCount(); }

	// Amount of system memory present (RO).
	CUSTOM_PROP static int systemMemorySize { return systeminfo::GetPhysicalMemoryMB(); }


	// Amount of video memory present (RO).
	CUSTOM_PROP static int graphicsMemorySize { return (int)gGraphicsCaps.videoMemoryMB; }


	// The name of the graphics device (RO).
	CUSTOM_PROP static string graphicsDeviceName { return scripting_string_new(gGraphicsCaps.rendererString.c_str()); }


	// The vendor of the graphics device (RO).
	CUSTOM_PROP static string graphicsDeviceVendor { return scripting_string_new(gGraphicsCaps.vendorString.c_str()); }


	// The identifier code of the graphics device (RO).
	CUSTOM_PROP static int graphicsDeviceID { return gGraphicsCaps.rendererID; }


	// The identifier code of the graphics device vendor (RO).
	CUSTOM_PROP static int graphicsDeviceVendorID { return gGraphicsCaps.vendorID; }


	// The graphics API version supported by the graphics device (RO).
	CUSTOM_PROP static string graphicsDeviceVersion { return scripting_string_new(gGraphicsCaps.fixedVersionString.c_str()); }



	// Graphics device shader capability level (RO).
	CUSTOM_PROP static int graphicsShaderLevel { return gGraphicsCaps.shaderCaps; }


	// Approximate pixel fill-rate of the graphics device (RO).
	CUSTOM_PROP static int graphicsPixelFillrate {
		return GetGraphicsPixelFillrate (gGraphicsCaps.vendorID, gGraphicsCaps.rendererID);
	}


	// Are built-in shadows supported? (RO)
	CUSTOM_PROP static bool supportsShadows {
		return RenderTexture::IsEnabled() && GetBuildSettings().hasShadows && gGraphicsCaps.supportsRenderTextureFormat[kRTFormatDepth];
	}
	// Are render textures supported? (RO)
	CUSTOM_PROP static bool supportsRenderTextures {
		return RenderTexture::IsEnabled();
	}
	CUSTOM_PROP static bool supportsRenderToCubemap {
		return RenderTexture::IsEnabled() && (gGraphicsCaps.hasRenderToCubemap);
	}
	// Are image effects supported? (RO)
	CUSTOM_PROP static bool supportsImageEffects {
		return RenderTexture::IsEnabled() && (gGraphicsCaps.npotRT >= kNPOTRestricted);
	}

	// Are 3D (volume) textures supported? (RO)
	CUSTOM_PROP static bool supports3DTextures {
		return gGraphicsCaps.has3DTexture;
	}

	// Are compute shaders supported? (RO)
	CUSTOM_PROP static bool supportsComputeShaders {
		return gGraphicsCaps.hasComputeShader;
	}

	// Is GPU draw call instancing supported? (RO)
	CUSTOM_PROP static bool supportsInstancing {
		return gGraphicsCaps.hasInstancing;
	}

	// How many simultaneous render targets (MRTs) are supported? (RO)
	CUSTOM_PROP static int supportedRenderTargetCount {
		return RenderTexture::IsEnabled() ? gGraphicsCaps.maxMRTs : 0;
	}

	// Is the stencil buffer supported? (RO)
	CUSTOM_PROP static int supportsStencil {
		return gGraphicsCaps.hasStencil && GetBuildSettings ().hasAdvancedVersion;
	}

	//*undocumented*
	CUSTOM_PROP static bool supportsVertexPrograms { return true; }

	// Is render texture format supported?
	CUSTOM static bool SupportsRenderTextureFormat (RenderTextureFormat format) {
		return RenderTexture::IsEnabled() && gGraphicsCaps.supportsRenderTextureFormat[format];
	}

	/// What [[NPOT|NPOTSupport]] support does GPU provide? (RO)
	///
	/// SA: [[NPOTSupport]] enum.
	CUSTOM_PROP static NPOTSupport npotSupport { return gGraphicsCaps.npot; }

	//A unique device identifier. It is guaranteed to be unique for every device (RO).
	CONDITIONAL !UNITY_FLASH && !UNITY_WEBGL
	CUSTOM_PROP static string deviceUniqueIdentifier {
		return scripting_string_new (systeminfo::GetDeviceUniqueIdentifier ());
	}

	// The user defined name of the device (RO).
	CONDITIONAL !UNITY_FLASH && !UNITY_WEBGL
	CUSTOM_PROP static string deviceName {
		return scripting_string_new (systeminfo::GetDeviceName ());
	}

	// The model of the device (RO).
	CONDITIONAL !UNITY_FLASH && !UNITY_WEBGL
	CUSTOM_PROP static string deviceModel {
		return scripting_string_new (systeminfo::GetDeviceModel ());
	}

	// Returns a boolean value that indicates whether an accelerometer is
	CUSTOM_PROP static bool supportsAccelerometer {
		return systeminfo::SupportsAccelerometer ();
	}

	// Returns a boolean value that indicates whether a gyroscope is available
	CUSTOM_PROP static bool supportsGyroscope {
		return IsGyroAvailable ();
	}

	// Returns a boolean value that indicates whether the device is capable to
	CUSTOM_PROP static bool supportsLocationService {
		return systeminfo::SupportsLocationService ();
	}

	// Returns a boolean value that indicates whether the device is capable to
	CUSTOM_PROP static bool supportsVibration {
		return systeminfo::SupportsVibration ();
	}

	// Returns the kind of device the application is running on. See [[DeviceType]] enumeration for possible values.
	CUSTOM_PROP static DeviceType deviceType
	{
		return systeminfo::DeviceType ();
	}

	CUSTOM_PROP static int maxTextureSize
	{
		return gGraphicsCaps.maxTextureSize;
	}

END

// Suspends the coroutine execution for the given amount of seconds.
CSRAW [StructLayout(LayoutKind.Sequential)]
CLASS WaitForSeconds : YieldInstruction
	//*undocumented*
	CSRAW internal float m_Seconds;

	// Creates a yield instruction to wait for a given number of seconds
	CSRAW public WaitForSeconds (float seconds) { m_Seconds = seconds; }
END

// Waits until next fixed frame rate update function. SA: MonoBehaviour::pref::FixedUpdate.
CLASS WaitForFixedUpdate : YieldInstruction
END

// Waits until the end of the frame after all cameras and GUI is rendered, just before displaying the frame on screen.
CLASS WaitForEndOfFrame : YieldInstruction
END


// MonoBehaviour.StartCoroutine returns a Coroutine. Instances of this class are only used to reference these coroutines and do not hold any exposed properties or functions.
CSRAW [StructLayout (LayoutKind.Sequential)]

CLASS Coroutine : YieldInstruction
	CSRAW internal IntPtr m_Ptr;
	private Coroutine () { }

	THREAD_SAFE
	CUSTOM private void ReleaseCoroutine ()
	{
		Assert (self.GetPtr() != NULL);
		Coroutine::CleanupCoroutineGC (self);
	}

	CSRAW
	~Coroutine ()
	{
		ReleaseCoroutine ();
	}
END

CSRAW

// The RequireComponent attribute lets automatically add required component as a dependency.


CSRAW [AttributeUsage(AttributeTargets.Class, AllowMultiple=true)]
CLASS RequireComponent  : Attribute
	//*undocumented*
	CSRAW public Type m_Type0;
	//*undocumented*
	CSRAW public Type m_Type1;
	//*undocumented*
	CSRAW public Type m_Type2;

	// Require a single component
	CSRAW public RequireComponent (Type requiredComponent) { m_Type0 = requiredComponent; }
	// Require a two components
	CSRAW public RequireComponent (Type requiredComponent, Type requiredComponent2) { m_Type0 = requiredComponent; m_Type1 = requiredComponent2;  }
	// Require three components
	CSRAW public RequireComponent (Type requiredComponent, Type requiredComponent2, Type requiredComponent3) { m_Type0 = requiredComponent; m_Type1 = requiredComponent2; m_Type2 = requiredComponent3; }
END


// The AddComponentMenu attribute allows you to place a script anywhere in the "Component" menu, instead of just the "Component->Scripts" menu.

CLASS AddComponentMenu : Attribute
	CSRAW private string m_AddComponentMenu;

	// The script will be placed in the component menu according to /menuName/. /menuName/ is the path to the component
	CSRAW public AddComponentMenu (string menuName) { m_AddComponentMenu = menuName; }

	//* undocumented
	CSRAW public string componentMenu { get {return m_AddComponentMenu; } }
END


// The ContextMenu attribute allows you to add commands to the context menu
CLASS ContextMenu  : Attribute

	// Adds the function to the context menu of the component.
	CSRAW public ContextMenu (string name) { m_ItemName = name; }


	CSRAW private string m_ItemName;

	//* undocumented
	CSRAW public string menuItem { get { return m_ItemName; } }
END


// Makes a script execute in edit mode.
CLASS ExecuteInEditMode : Attribute
END


// Makes a variable not show up in the inspector but be serialized.
CLASS HideInInspector : Attribute
END

// A class you can derive from if you want to create objects that don't need to be attached to game objects.
CSRAW
[StructLayout (LayoutKind.Sequential)]
NONSEALED_CLASS ScriptableObject : Object

	//*undocumented* Users are not supposed to instantiate unextended ScriptableObjects, are they?
	CSRAW public ScriptableObject ()
	{
		Internal_CreateScriptableObject(this);
	}

	THREAD_SAFE
	CUSTOM private static void Internal_CreateScriptableObject([Writable]ScriptableObject self)
	{
		Scripting::CreateEngineScriptableObject(self.GetScriptingObject());
	}

	CONDITIONAL ENABLE_MONO
	OBSOLETE warning Use EditorUtility.SetDirty instead
	AUTO void SetDirty ();

	// Creates an instance of a scriptable object with /className/.
	CUSTOM static ScriptableObject CreateInstance (string className) { return Scripting::CreateScriptableObject (className.AsUTF8()); }

	// Creates an instance of a scriptable object with /type/.
	CSRAW public static ScriptableObject CreateInstance (Type type) { return CreateInstanceFromType(type); }

	CUSTOM private static ScriptableObject CreateInstanceFromType (Type type) { return Scripting::CreateScriptableObjectWithType (type); }

	CSRAW
	#if ENABLE_GENERICS
	// Creates an instance of a scriptable object with /T/.
	public static T CreateInstance<T> () where T : ScriptableObject
	{
		return (T)CreateInstance(typeof(T));
	}
	#endif

	// This function is called when the object is loaded
	CSNONE void OnEnable ();


	// This function is called when the scriptable object goes out of scope
	CSNONE void OnDisable();

	// This function is called when the scriptable object will be destroyed.
	CSNONE void OnDestroy();


END

// The Resources class allows you to find and access Objects including assets.
CLASS Resources

	CONDITIONAL (ENABLE_GENERICS && !UNITY_FLASH)
	CSRAW internal static T[] ConvertObjects<T>(Object[] rawObjects) where T : Object
	{
		if (rawObjects == null) return null;
		T[] typedObjects = new T[rawObjects.Length];
		for (int i = 0; i < typedObjects.Length; i++)
			typedObjects[i] = (T)rawObjects[i];
		return typedObjects;
	}

	// Returns a list of all objects of Type /type/.
	CSRAW
	[TypeInferenceRule(TypeInferenceRules.ArrayOfTypeReferencedByFirstArgument)]
	CUSTOM static Object[] FindObjectsOfTypeAll (Type type) { DISALLOW_IN_CONSTRUCTOR return Scripting::FindObjectsOfType (type, Scripting::kFindAnything); }
	
	CONDITIONAL (ENABLE_GENERICS && !UNITY_FLASH)
	CSRAW public static T[] FindObjectsOfTypeAll<T> () where T : Object
	{
		return ConvertObjects<T>(FindObjectsOfTypeAll (typeof (T)));
	}

	// Loads an asset stored at /path/ in a Resources folder.

	CSRAW public static Object Load (string path)
	{
		return Load(path, typeof(Object));
	}
	
	CONDITIONAL ENABLE_GENERICS
	CSRAW public static T Load<T> (string path) where T : Object
	{
		return (T) Load (path, typeof (T));
	}

	// Loads an asset stored at /path/ in a Resources folder.
	CSRAW
	[TypeInferenceRule(TypeInferenceRules.TypeReferencedBySecondArgument)]
	CUSTOM static Object Load (string path, Type systemTypeInstance)
	{
		Scripting::RaiseIfNull (systemTypeInstance);

		ScriptingClassPtr klass = GetScriptingTypeRegistry().GetType(systemTypeInstance);
		string lowerPath = ToLower(path.AsUTF8());
		ResourceManager::range found = GetResourceManager().GetPathRange(lowerPath);

		Object* obj = NULL;
		ScriptingObjectPtr o = SCRIPTING_NULL;
		for (ResourceManager::iterator i=found.first;i != found.second;i++)
		{
			obj = i->second;
			GetResourceManager ().PreloadDependencies (obj->GetInstanceID ());
			
			o = Scripting::ScriptingWrapperFor(obj);
			if (o == SCRIPTING_NULL)
				continue;

			ScriptingClassPtr k = scripting_object_get_class(o, GetScriptingTypeRegistry());
			if (o && scripting_class_is_subclass_of(k,klass))
			{
				break;
			}

			GameObject* go = dynamic_pptr_cast<GameObject*> (obj);
			if (go != NULL)
			{
				o = ScriptingGetComponentOfType(*go, systemTypeInstance, false);
				if (o != SCRIPTING_NULL)
				{
					break;
				}
			}
		}

		// Android keeps its Resources folder split up (to minimize seeks inside the .apk)
		// To not "leak" SerializedFile objects we need to unload the added stream here..
		if (obj && UNITY_ANDROID)
		{
			PersistentManager& pm = GetPersistentManager();
			pm.UnloadNonDirtyStreams();
		}

		return o;
	}

	// Loads all assets in a folder or file at /path/ in a Resources folder.
	CUSTOM static Object[] LoadAll (string path, Type systemTypeInstance)
	{
		Scripting::RaiseIfNull (systemTypeInstance);

		ScriptingClassPtr klass = GetScriptingTypeRegistry().GetType(systemTypeInstance);
		ResourceManager::range found = GetResourceManager().GetAll();
		string cpath = ToLower(path.AsUTF8());

		vector<PPtr<Object> > objects;

		for (ResourceManager::iterator i=found.first;i != found.second;i++)
		{
			// Path doesn't match (But allow empty path for all objects)
			if (!StartsWithPath(i->first, cpath))
				continue;

			Object* obj = i->second;
			GetResourceManager ().PreloadDependencies (obj->GetInstanceID ());

			ScriptingObjectPtr o = Scripting::ScriptingWrapperFor(obj);
			if (o == SCRIPTING_NULL)
				continue;

			ScriptingClassPtr k = scripting_object_get_class(o, GetScriptingTypeRegistry());
			if (o && scripting_class_is_subclass_of(k, klass))
			{
				objects.push_back(i->second);
			}
			else
			{
				GameObject* go = dynamic_pptr_cast<GameObject*> (obj);
				if (go != NULL)
				{
					o = ScriptingGetComponentOfType(*go, systemTypeInstance, false);
					if (o != SCRIPTING_NULL)
					{
						objects.push_back(ScriptingObjectToObject<Object>(o));
					}
				}
			}
		}

		return CreateScriptingArrayFromUnityObjects (objects, ClassID(Object));
	}

	// Loads all assets in a folder or file at /path/ in a Resources folder.

	CSRAW public static Object[] LoadAll (string path)
	{
		return LoadAll(path, typeof(Object));
	}
	
	CONDITIONAL (ENABLE_GENERICS && !UNITY_FLASH)
	CSRAW public static T[] LoadAll<T> (string path) where T : Object
	{
		return ConvertObjects<T>(LoadAll (path, typeof (T)));
	}
	
	// *undocumented
	CSRAW
	[TypeInferenceRule(TypeInferenceRules.TypeReferencedByFirstArgument)]
	CUSTOM static Object GetBuiltinResource (Type type, string path)
	{
		Scripting::RaiseIfNull(type);
		return GetScriptingBuiltinResource(type, path.AsUTF8());
	}

	CONDITIONAL ENABLE_GENERICS
	CSRAW public static T GetBuiltinResource<T> (string path) where T : Object
	{
		return (T) GetBuiltinResource (typeof (T), path);
	}

	// Returns a resource at an asset path (Editor Only).
	CSRAW
	[TypeInferenceRule(TypeInferenceRules.TypeReferencedBySecondArgument)]
	CUSTOM static Object LoadAssetAtPath (string assetPath, Type type)
	{
		#if UNITY_EDITOR
		return LoadAssetAtPath(assetPath, type);
		#else
		return SCRIPTING_NULL;
		#endif
	}

	CONDITIONAL ENABLE_GENERICS
	CSRAW public static T LoadAssetAtPath<T> (string assetPath) where T : Object
	{
		return (T) LoadAssetAtPath (assetPath, typeof (T));
	}

	// Unloads /assetToUnload/ from memory.
	CUSTOM static void UnloadAsset (Object assetToUnload) { Scripting::UnloadAssetFromScripting (assetToUnload); }

	// Unloads assets that are not used.
	CUSTOM static AsyncOperation UnloadUnusedAssets ()
	{
		AsyncOperation* result = UnloadUnusedAssetsOperation::UnloadUnusedAssets ();
		ScriptingObjectPtr o = scripting_object_new(MONO_COMMON.asyncOperation);
		ScriptingObjectWithIntPtrField<AsyncOperation>(o).SetPtr(result);
		return o;
	}

END


OBSOLETE warning Use SerializeField on the private variables that you want to be serialized instead
CLASS SerializePrivateVariables : Attribute
END

// Priority of a thread.
ENUM ThreadPriority
	// Lowest thread priority
	Low = 0,
	// Below normal thread priority
	BelowNormal = 1,
	// Normal thread priority
	Normal = 2,
	// Highest thread priority
	High = 4
END


// Force Unity to serialize a private field.



CLASS SerializeField : Attribute
END

// Controls the [[wiki:Profiler]] from script.
CLASS Profiler

	// *undocumented*
	CUSTOM_PROP static bool supported
	{
		#if ENABLE_PROFILER
		return GetBuildSettings().hasPROVersion;
		#else
		return false;
		#endif
	}


	// Sets profiler output file in built players.
	CUSTOM_PROP static string logFile
	{
		#if ENABLE_PROFILER
		return scripting_string_new(UnityProfiler::Get().GetLogPath());
		#else
		return SCRIPTING_NULL;
		#endif
	}
	{
		#if ENABLE_PROFILER
		if (!GetBuildSettings().hasPROVersion)
		{
			ErrorString("Profiler is only supported in Unity Pro.");
			return;
		}
		UnityProfiler::Get().SetLogPath(value);
		#else
		ErrorString("Profiler is not supported in this build");
		#endif
	}

	// Sets profiler output file in built players.
	CUSTOM_PROP static bool enableBinaryLog
	{
		#if ENABLE_PROFILER
		return UnityProfiler::Get().BinaryLogEnabled();
		#else
		return false;
		#endif
	}
	{
		#if ENABLE_PROFILER
		if (!GetBuildSettings().hasPROVersion)
		{
			ErrorString("Profiler is only supported in Unity Pro.");
			return;
		}
		UnityProfiler::Get().EnableBinaryLog(value);
		#else
		ErrorString("Profiler is not supported in this build");
		#endif
	}

	// Enables the Profiler.
	CUSTOM_PROP static bool enabled
	{
		#if ENABLE_PROFILER
		return UnityProfiler::Get().GetEnabled();
		#else
		return false;
		#endif
	}
	{
		#if ENABLE_PROFILER
		if (!GetBuildSettings().hasPROVersion)
		{
			ErrorString("Profiler is only supported in Unity Pro.");
			return;
		}
		return UnityProfiler::Get().SetEnabled(value);
		#else
		ErrorString("Profiler is not supported in this build");
		#endif
	}


	// Displays the recorded profiledata in the profiler.
	CSRAW [System.Diagnostics.ConditionalAttribute("ENABLE_PROFILER")]
	CUSTOM static void AddFramesFromFile (string file)
	{
		#if ENABLE_PROFILER
		if(file.Length() == 0)
		{
			ErrorString ("AddFramesFromFile: Invalid empty path");
			return;
		}
		UnityProfiler::Get().AddFramesFromFile(file);
		#endif
	}


	/// *listonly*
	CSRAW [System.Diagnostics.ConditionalAttribute("ENABLE_PROFILER")]
	CSRAW static public void BeginSample(string name)
	{
		BeginSampleOnly(name);
	}

	// Begin profiling a piece of code with a custom label.
	CSRAW [System.Diagnostics.ConditionalAttribute("ENABLE_PROFILER")]
	CUSTOM static void BeginSample(string name, Object targetObject)
	{
		#if ENABLE_PROFILER
		UnityProfilerPerThread* prof = UnityProfilerPerThread::ms_InstanceTLS;
		if (prof && prof->GetIsActive())
			prof->BeginSampleDynamic(name, targetObject);
		#endif
	}

	CUSTOM private static void BeginSampleOnly(string name)
	{
		#if ENABLE_PROFILER
		UnityProfilerPerThread* prof = UnityProfilerPerThread::ms_InstanceTLS;
		if (prof && prof->GetIsActive())
			prof->BeginSampleDynamic(name, NULL);
		#endif
	}

	// End profiling a piece of code with a custom label.
	CSRAW [System.Diagnostics.ConditionalAttribute("ENABLE_PROFILER")]
	CUSTOM static void EndSample ()
	{
		#if ENABLE_PROFILER
		UnityProfilerPerThread* prof = UnityProfilerPerThread::ms_InstanceTLS;
		if (prof)
			prof->EndSampleDynamic();
		#endif
	}

	// Heap size used by the program
	CUSTOM_PROP static uint usedHeapSize
	{
		#if ENABLE_PROFILER
		return GetUsedHeapSize();
		#else
		return 0;
		#endif
	}

	// Returns the runtime memory usage of the resource.

	CUSTOM static int GetRuntimeMemorySize(Object o)
	{
		#if ENABLE_PROFILER
			return o->GetRuntimeMemorySize();
		#else
			return 0;
		#endif
	}

	// Returns the size of the mono heap
	CUSTOM static uint GetMonoHeapSize ()
	{
		#if ENABLE_PROFILER && ENABLE_MONO
			return mono_gc_get_heap_size ();
		#else
			return 0;
		#endif
	 }

	// Returns the used size from mono
	CUSTOM static uint GetMonoUsedSize ()
	{
		#if ENABLE_PROFILER && ENABLE_MONO
			return mono_gc_get_used_size ();
		#else
			return 0;
		#endif
	}
	///*undocumented*
	CUSTOM static uint GetTotalAllocatedMemory()
	{
		#if ENABLE_MEMORY_MANAGER
			return GetMemoryManager().GetTotalAllocatedMemory();
		#else
			return 0;
		#endif
	}
	///*undocumented*
	CUSTOM static uint GetTotalUnusedReservedMemory()
	{
		#if ENABLE_MEMORY_MANAGER
			return GetMemoryManager().GetTotalUnusedReservedMemory();
		#else
			return 0;
		#endif
	}
	///*undocumented*
	CUSTOM static uint GetTotalReservedMemory()
	{
		#if ENABLE_MEMORY_MANAGER
			return GetMemoryManager().GetTotalReservedMemory();
		#else
			return 0;
		#endif
	}

	//CUSTOM static void SharkBeginRemoteProfiling ()
	//{
	//	#if ENABLE_SHARK_PROFILE
	//	SharkBeginRemoteProfiling();
	//	#endif
	//}
	//
	//CUSTOM static void SharkEndRemoteProfiling ()
	//{
	//	#if ENABLE_SHARK_PROFILE
	//	SharkEndRemoteProfiling();
	//	#endif
	//}
END

CSRAW }

CSRAW
namespace UnityEngineInternal
{

using UnityEngine;

//*undocumented*
// class for reproduction framework
CONDITIONAL ENABLE_MONO
CLASS Reproduction

	CUSTOM static void CaptureScreenshot ()
	{
#if SUPPORT_REPRODUCE_LOG
		CaptureScreenshotReproduction(true);
#else
		Scripting::RaiseMonoException("This method only works with internal development builds.");
#endif
	}

END

CSRAW }