feat(scripting): add script add-component api

This commit is contained in:
2026-03-27 15:32:37 +08:00
parent 9c94adb4a2
commit f0d6d4f41c
10 changed files with 401 additions and 6 deletions

View File

@@ -46,6 +46,12 @@ namespace XCEngine
return Component.Create<T>(componentOwnerUUID);
}
public T AddComponent<T>() where T : Component
{
ulong componentOwnerUUID = InternalCalls.GameObject_AddComponent(UUID, typeof(T));
return Component.Create<T>(componentOwnerUUID);
}
public bool TryGetComponent<T>(out T component) where T : Component
{
component = GetComponent<T>();