forked from Unity-Technologies/UnityCsReference
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAttributes.cs
More file actions
139 lines (115 loc) · 5.21 KB
/
Copy pathAttributes.cs
File metadata and controls
139 lines (115 loc) · 5.21 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
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
// 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 UnityEngine.Scripting;
namespace UnityEngine
{
[RequiredByNativeCode]
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
public sealed class DisallowMultipleComponent : Attribute {}
// The RequireComponent attribute lets automatically add required component as a dependency.
[RequiredByNativeCode]
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public sealed class RequireComponent : Attribute
{
//*undocumented*
public Type m_Type0;
//*undocumented*
public Type m_Type1;
//*undocumented*
public Type m_Type2;
// Require a single component
public RequireComponent(Type requiredComponent) { m_Type0 = requiredComponent; }
// Require a two components
public RequireComponent(Type requiredComponent, Type requiredComponent2) { m_Type0 = requiredComponent; m_Type1 = requiredComponent2; }
// Require three components
public RequireComponent(Type requiredComponent, Type requiredComponent2, Type requiredComponent3) { m_Type0 = requiredComponent; m_Type1 = requiredComponent2; m_Type2 = requiredComponent3; }
}
// The AddComponentMenu attribute allows you to place a script anywhere in the "Component" menu, instead of just the "Component->Scripts" menu.
public sealed class AddComponentMenu : Attribute
{
private string m_AddComponentMenu;
private int m_Ordering;
// The script will be placed in the component menu according to /menuName/. /menuName/ is the path to the component
public AddComponentMenu(string menuName) { m_AddComponentMenu = menuName; m_Ordering = 0; }
// same as above, but also specify a custom Ordering.
public AddComponentMenu(string menuName, int order) { m_AddComponentMenu = menuName; m_Ordering = order; }
//* undocumented
public string componentMenu { get {return m_AddComponentMenu; } }
//* undocumented
public int componentOrder { get {return m_Ordering; } }
}
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public sealed class CreateAssetMenuAttribute : Attribute
{
public string menuName { get; set; }
public string fileName { get; set; }
public int order { get; set; }
}
// The ContextMenu attribute allows you to add commands to the context menu
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
[RequiredByNativeCode]
public sealed class ContextMenu : Attribute
{
// Creates a context menu item that invokes the non-static method when selected
public ContextMenu(string itemName) : this(itemName, false) {}
public ContextMenu(string itemName, bool isValidateFunction) : this(itemName, isValidateFunction, 1000000) {}
public ContextMenu(string itemName, bool isValidateFunction, int priority)
{
menuItem = itemName;
validate = isValidateFunction;
this.priority = priority;
}
//*undocumented*
public readonly string menuItem;
//*undocumented*
public readonly bool validate;
//*undocumented*
public readonly int priority;
}
// Makes a script execute in edit mode.
[UsedByNativeCode]
public sealed class ExecuteInEditMode : Attribute {}
// Makes a script execute always: when in edit mode, play mode (also for scripts prefab isolation mode in play mode)
[UsedByNativeCode]
public sealed class ExecuteAlways : Attribute {}
// Makes a variable not show up in the inspector but be serialized.
[UsedByNativeCode]
public sealed class HideInInspector : Attribute {}
// Sets a custom help URL for a script.
[UsedByNativeCode]
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public sealed class HelpURLAttribute : Attribute
{
public HelpURLAttribute(string url) { m_Url = url; m_DispatchingFieldName = ""; m_Dispatcher = false; }
//internal ability to retarget the url on an inside field value's type's HelpURL
internal HelpURLAttribute(string defaultURL, string dispatchingFieldName) { m_Url = defaultURL; m_DispatchingFieldName = dispatchingFieldName; m_Dispatcher = !String.IsNullOrEmpty(dispatchingFieldName); }
public string URL => m_Url;
internal readonly string m_Url;
internal readonly bool m_Dispatcher;
internal readonly string m_DispatchingFieldName;
}
[UsedByNativeCode]
[AttributeUsage(AttributeTargets.Class)]
public class DefaultExecutionOrder : Attribute
{
public DefaultExecutionOrder(int order)
{
m_Order = order;
}
public int order
{
get { return m_Order; }
}
int m_Order;
}
[AttributeUsage(AttributeTargets.Assembly)]
[RequiredByNativeCode]
public class AssemblyIsEditorAssembly : Attribute
{
}
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
[UsedByNativeCode]
public class ExcludeFromPresetAttribute : Attribute {}
}