puerts icon indicating copy to clipboard operation
puerts copied to clipboard

[UE] Bug: TS定义一个的property组件找不到SetAnimClass()函数

Open dawnarc opened this issue 1 year ago • 5 comments

前置阅读 | Pre-reading

Puer的版本 | Puer Version

master分支

UE的版本 | UE Version

5.0.3

发生在哪个平台 | Platform

win

错误信息 | Error Message

测试代码: image 运行时报错: 2024 05 17_王爱国 8b8018dfa3def78ff978c3dcf3fbf5ff C++定义的mesh没这个问题,调用SetAnimClass()不报错,且结果符合预期。

问题重现 | Bug reproduce

如上所述

dawnarc avatar May 17 '24 13:05 dawnarc

定义一个变量没赋值不是应该是空吗? 你C++定义没赋值也是个随机值吧?

chexiongsheng avatar May 17 '24 16:05 chexiongsheng

@chexiongsheng

定义一个变量没赋值不是应该是空吗?

Puerts新版本中貌似只要定义变量,就会自动创建对象,不用像以前在构造中手动CreateDefaultSubobject了吧?

你C++定义没赋值也是个随机值吧?

C++定义的是已经创建好对象的(前面我说的不严谨,我说的c++的mesh其实是引擎Character内自带的Mesh)

dawnarc avatar May 18 '24 03:05 dawnarc

@chexiongsheng 刚刚用最新的5.4.1版本测了下,定义的成员变量如果为StaticMesh会自动创建,如果为SkeletalMesh,不会自动创建 image image

将类型从StaticMesh改成SkeletalMesh,蓝图中就看不见这个组件了: image image 这种属于正常情况吗? 另外5.0.3版本下SkeletaMesh类型的成员变量不用手动CreateDefaultSubobject,也会在蓝图中自动生成组件。(5.03是公司项目引擎版本,各种原因导致无法升到5.4)

dawnarc avatar May 18 '24 07:05 dawnarc

只有UActorComponent子类才会添加:https://github.com/Tencent/puerts/commit/b3c9c599a6c323808b24080b75fa1b71ffcaff1f

chexiongsheng avatar May 20 '24 06:05 chexiongsheng

@chexiongsheng 我看代码SkeletalMeshComponent的父类也是UActorComponent,按理说应该也能够生成: image

dawnarc avatar May 22 '24 16:05 dawnarc