Files
XCEngine/docs/api/XCEngine/Scripting/Mono/MonoScriptRuntime/CreateManagedComponentWrapper.md

32 lines
856 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# MonoScriptRuntime::CreateManagedComponentWrapper
**命名空间**: `XCEngine::Scripting`
**类型**: `method`
**头文件**: `XCEngine/Scripting/Mono/MonoScriptRuntime.h`
## 签名
```cpp
MonoObject* CreateManagedComponentWrapper(
MonoClass* componentClass,
uint64_t gameObjectUUID);
```
## 当前实现行为
- 只有在运行时已初始化、`componentClass` 非空且 `gameObjectUUID` 非零时才继续。
- 查找目标托管包装类型的单参构造函数。
- 创建托管对象。
-`gameObjectUUID` 作为构造参数调用该对象构造函数。
- 如果托管构造抛异常,会记录异常并返回 `nullptr`
## 用途
当前主要服务于 internal call例如从托管脚本中获取 `Transform``Camera``Light` 等原生组件包装对象。
## 相关文档
- [TryGetFieldValue](TryGetFieldValue.md)