Skip to content

Commit f00117e

Browse files
committed
feat(TypeTreeGenerator): add GetMonoBehaviourRootNodes function
1 parent 87ba76a commit f00117e

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

TypeTreeGeneratorAPI/TypeTreeGenerator/TypeTreeGenerator.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,23 @@ public TypeTreeGenerator(string unityVersionString)
1414
unityVersion = UnityVersion.Parse(unityVersionString);
1515
}
1616

17+
public List<TypeTreeNode> GetMonoBehaviourRootNodes()
18+
{
19+
var pathIdType = (unityVersion.Major >= 5) ? "SInt64" : "int";
20+
21+
return [
22+
new TypeTreeNode("MonoBehaviour", "Base", 0, false),
23+
new TypeTreeNode("PPtr<GameObject>", "m_GameObject", 1, true),
24+
new TypeTreeNode("int", "m_FileID", 2, false),
25+
new TypeTreeNode(pathIdType, "m_PathID", 2, false),
26+
new TypeTreeNode("UInt8", "m_Enabled", 1, false),
27+
new TypeTreeNode("PPtr<MonoScript>", "m_Script", 1, true), // PPtr
28+
new TypeTreeNode("int", "m_FileID", 2, false),
29+
new TypeTreeNode(pathIdType, "m_PathID", 2, false),
30+
new TypeTreeNode("String", "m_Name", 1, true)
31+
];
32+
}
33+
1734
abstract public List<(string, string)> GetMonoBehaviourDefinitions();
1835
abstract public List<TypeTreeNode>? GenerateTreeNodes(string assemblyName, string fullName);
1936

@@ -28,7 +45,7 @@ virtual public void LoadDll(byte[] dll)
2845
LoadDll(dllStream);
2946
}
3047
}
31-
48+
3249
#if ENABLE_IL2CPP
3350
public virtual void LoadIl2Cpp(byte[] assemblyData, byte[] metadataData)
3451
{

0 commit comments

Comments
 (0)