Code Monkey home page Code Monkey logo

Comments (10)

chexiongsheng avatar chexiongsheng commented on July 22, 2024

你试试先加载了子类,然后再mixin父类?

from puerts.

lzj10 avatar lzj10 commented on July 22, 2024

我多测试了几次 ,感觉跟编辑器启动的加载顺序有关 ,跟代码里的类加载顺序关系不大,多重启几次编辑器有的时候调用父类就可以生效,但是调用生效的时候不关闭编辑器,PIE第二次会卡死。

from puerts.

lzj10 avatar lzj10 commented on July 22, 2024

多次重启工程,有时候调用父类生效了,但是再次PIE直接卡死
image
image
卡死的时候应该是调用到父类ReceiveBeginPlay的时候,父类子类的ReceiveBeginPlay都没有打印出来 ,testfunction都执行成功
image

from puerts.

lzj10 avatar lzj10 commented on July 22, 2024

追踪到是在蓝图执行的时候死循环了
image
image

from puerts.

lzj10 avatar lzj10 commented on July 22, 2024

提交了一个demo分支
https://github.com/lzj10/puerts_unreal_demo/tree/test_mixin

from puerts.

lzj10 avatar lzj10 commented on July 22, 2024

感觉第二次PIE启动的时候子类ReceieveBeginPlay的SuperStruct和父类的ReceieveBeginPlay的UFunction对象地址不同,TestFunction是一致的
2ce91b3ea94b9193e90adff2bab5b1e
211e14dee1003e760b259acfa7bef64

from puerts.

chexiongsheng avatar chexiongsheng commented on July 22, 2024

我没重现调用不到的情况。
倒是卡死是100%重现的。
卡死的原因倒是找到了:你给的demo,TestActor没有BeginPlay,你先mixin TestActor会导致TestActor添加BeginPlay,然后加载TestActor_Child会产生对TestActor添加BeginPlay的引用,然后停止播放后,被mixin的类都有一个restore行为,会把添加的方法删除,于是TestActor_Child引用了一个已经被删除的UFunction实例。

暂时的规避方法:你手动在TestActor添加一个空的BeginPlay重载。

from puerts.

chexiongsheng avatar chexiongsheng commented on July 22, 2024

你如果先加载了子类然后再mixin,子类调用基类将触发不了TestActor没有BeginPlay。因为对基类的调用已经定向到Actor那了。这应该是你偶尔不触发的原因。

from puerts.

lzj10 avatar lzj10 commented on July 22, 2024

收到 感谢~

from puerts.

chexiongsheng avatar chexiongsheng commented on July 22, 2024

我把卡死解决掉。不过如果TestActor没有BeginPlay的话,仍然根据加载顺序不一样会出现不触发的可能。然后通过文档约束下。

from puerts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.