forked from Unity-Technologies/UnityCsReference
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScriptableObject.bindings.cs
More file actions
59 lines (49 loc) · 2.11 KB
/
Copy pathScriptableObject.bindings.cs
File metadata and controls
59 lines (49 loc) · 2.11 KB
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
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
using System;
using System.Runtime.InteropServices;
using UnityEngine.Scripting;
using UnityEngine.Bindings;
namespace UnityEngine
{
// A class you can derive from if you want to create objects that don't need to be attached to game objects.
[StructLayout(LayoutKind.Sequential)]
[RequiredByNativeCode]
[ExtensionOfNativeClass]
[NativeClass(null)]
[NativeHeader("Runtime/Mono/MonoBehaviour.h")]
public class ScriptableObject : Object
{
public ScriptableObject()
{
CreateScriptableObject(this);
}
[NativeConditional("ENABLE_MONO")]
[Obsolete("Use EditorUtility.SetDirty instead")]
public extern void SetDirty();
// Creates an instance of a scriptable object with /className/.
public static ScriptableObject CreateInstance(string className)
{
return CreateScriptableObjectInstanceFromName(className);
}
// Creates an instance of a scriptable object with /type/.
public static ScriptableObject CreateInstance(Type type)
{
return CreateScriptableObjectInstanceFromType(type, true);
}
// Creates an instance of a scriptable object with /T/.
public static T CreateInstance<T>() where T : ScriptableObject
{
return (T)CreateInstance(typeof(T));
}
[NativeMethod(IsThreadSafe = true)]
extern static void CreateScriptableObject([Writable] ScriptableObject self);
[FreeFunction("Scripting::CreateScriptableObject")]
extern static ScriptableObject CreateScriptableObjectInstanceFromName(string className);
[FreeFunction("Scripting::CreateScriptableObjectWithType")]
extern internal static ScriptableObject CreateScriptableObjectInstanceFromType(Type type, bool applyDefaultsAndReset);
[FreeFunction("Scripting::ResetAndApplyDefaultInstances")]
extern internal static void ResetAndApplyDefaultInstances(Object obj);
}
}