feat(scripting): add script add-component api
This commit is contained in:
@@ -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>();
|
||||
|
||||
Reference in New Issue
Block a user