Tencent / puerts

PUER(普洱) Typescript. Let's write your game in UE or Unity with TypeScript.
Other
5.05k stars 704 forks source link

[UE] Bug: 从c++获取到的uobject ,赋值到ts类成员变量,ts变量有被gc可能。 #1890

Open pheyahu opened 5 hours ago

pheyahu commented 5 hours ago

前置阅读 | Pre-reading

Puer的版本 | Puer Version

master

UE的版本 | UE Version

5.4.2

发生在哪个平台 | Platform

Editor(win)

错误信息 | Error Message

No response

问题重现 | Bug reproduce

不是继承 ts: class xxx private _component:UE.ActorComponent; init(actor:UE.Actor):void { this._component = actor.GetComponent();

}

tick() { this._component.DoSomething(); }

有一定几率出现this._component invalid 是不是开启宏WITH_OUTER_LINK可以解决这种问题? 如果不开启宏有没有更好的写法,还是每次tick都要从actor里获取component处理?

pheyahu commented 5 hours ago

补充下 是v8