-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Expand file tree
/
Copy pathSerializedModuleUI.cs
More file actions
72 lines (61 loc) · 2.21 KB
/
Copy pathSerializedModuleUI.cs
File metadata and controls
72 lines (61 loc) · 2.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
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
using UnityEngine;
namespace UnityEditor
{
internal class SerializedModule
{
protected string m_ModuleName;
protected SerializedObject m_Object;
public SerializedModule(SerializedObject o, string name)
{
m_Object = o;
m_ModuleName = name;
}
public SerializedProperty GetProperty0(string name)
{
SerializedProperty prop = m_Object.FindProperty(name);
if (prop == null)
Debug.LogError("GetProperty0: not found: " + name);
return prop;
}
public SerializedProperty GetProperty(string name)
{
SerializedProperty prop = m_Object.FindProperty(Concat(m_ModuleName, name));
if (prop == null)
Debug.LogError("GetProperty: not found: " + Concat(m_ModuleName, name));
return prop;
}
public SerializedProperty GetProperty0(string structName, string propName)
{
SerializedProperty prop = m_Object.FindProperty(Concat(structName, propName));
if (prop == null)
Debug.LogError("GetProperty: not found: " + Concat(structName, propName));
return prop;
}
public SerializedProperty GetProperty(string structName, string propName)
{
SerializedProperty prop = m_Object.FindProperty(Concat(Concat(m_ModuleName, structName), propName));
if (prop == null)
Debug.LogError("GetProperty: not found: " + Concat(Concat(m_ModuleName, structName), propName));
return prop;
}
public static string Concat(string a, string b)
{
return a + "." + b;
}
public string GetUniqueModuleName(Object o)
{
return Concat("" + o.GetEntityId(), m_ModuleName);
}
internal SerializedObject serializedObject
{
get { return m_Object; }
}
internal string moduleName
{
get { return m_ModuleName; }
}
}
} // namespace UnityEditor