blob: 7670d592097547710a44f288f4bae6d2506cf2f2 (
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
|
#ifndef SCRIPTINGUTILITY_H
#define SCRIPTINGUTILITY_H
#if ENABLE_SCRIPTING
#include "Runtime/Scripting/Backend/ScriptingTypes.h"
#include "Runtime/BaseClasses/BaseObject.h"
#include "Runtime/Scripting/Backend/ScriptingArguments.h"
#include "Runtime/Scripting/Backend/ScriptingInvocation.h"
#include "Runtime/Scripting/ICallString.h"
#if ENABLE_MONO_API_THREAD_CHECK && ENABLE_MONO
# include "Runtime/Threads/Thread.h"
# define SCRIPTINGAPI_CONSTRUCTOR_CHECK(NAME) \
if (GetMonoBehaviourInConstructor() == 0) ; else { \
Scripting::RaiseArgumentException("You are not allowed to call " #NAME " when declaring a variable.\nMove it to the line after without a variable declaration.\nDon't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function."); \
}
# define SCRIPTINGAPI_THREAD_CHECK(NAME) \
if ( Thread::CurrentThreadIsMainThread() ) ; else \
{\
ErrorString(#NAME " can only be called from the main thread.\nConstructors and field initializers will be executed from the loading thread when loading a scene.\nDon't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function."); \
Scripting::RaiseArgumentException(#NAME " can only be called from the main thread.\nConstructors and field initializers will be executed from the loading thread when loading a scene.\nDon't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.");\
}
#else
# define SCRIPTINGAPI_THREAD_CHECK(NAME)
# define SCRIPTINGAPI_CONSTRUCTOR_CHECK(NAME)
#endif
#if ENABLE_MONO
# include "Runtime/Mono/MonoIncludes.h"
# include "Runtime/Mono/MonoUtility.h"
#elif UNITY_WINRT
#elif UNITY_FLASH
# include "AS3Utility.h"
#endif
#include "Scripting.h"
//todo: put these back at the top when we've cleaned up the dependency mess
#include "Runtime/Scripting/ScriptingObjectOfType.h"
#include "Runtime/Scripting/ReadOnlyScriptingObjectOfType.h"
#endif //ENABLE_SCRIPTING
#endif
|