Coder Social home page Coder Social logo

Comments (2)

mhale1 avatar mhale1 commented on June 8, 2024

Well, you are defining the behavior of an Actor in potentially three layers. C++, Blueprint, and JS.

And, for example, C++ doesn't know anything about what is defined only at the level of Blueprint, but you can define placeholder functions in C++ and override them in Blueprint. So C++ can call Blueprint functionality that way.

Similarly, Blueprint doesn't know anything about what is defined only at the level of JS, but you can define placeholder functions in Blueprint and override them in JS. So Blueprint can call JS functionality that way.

So create a Blueprint, with an empty function. Extend the generated class of the Blueprint with a JS class using the syntax in the link you found. Override the function in the JS class with whatever functionality you want. Convert the JS class into an Unreal class/blueprint/actor with the require('uclass') syntax shown in the link you found. Create a new instance of this new Actor using the 'new' keyword syntax shown in the link you found. Now that your actor is in the game world if any other actor (defined via C++, Blueprint, or JS) interacts with it and calls that function name, it will execute the JS functionality you defined.

from unreal.js.

ladyishenlong avatar ladyishenlong commented on June 8, 2024

好吧,您正在潜在的三层中定义 Actor 的行为。C++、蓝图和 JS。

例如,C++ 对仅在蓝图级别定义的内容一无所知,但您可以在 C++ 中定义占位符函数并在蓝图中覆盖它们。所以 C++ 可以通过这种方式调用蓝图功能。

同样,Blueprint 不知道仅在 JS 级别定义的内容,但您可以在 Blueprint 中定义占位符函数并在 JS 中覆盖它们。所以 Blueprint 可以通过这种方式调用 JS 功能。

因此,创建一个带有空函数的蓝图。使用您找到的链接中的语法,使用 JS 类扩展生成的蓝图类。用你想要的任何功能覆盖 JS 类中的函数。使用您找到的链接中显示的 require('uclass') 语法将 JS 类转换为 Unreal 类/蓝图/actor。使用您找到的链接中显示的“new”关键字语法创建此新 Actor 的新实例。现在,如果任何其他 Actor(通过 C++、Blueprint 或 JS 定义)与其交互并调用该函数名称,您的 Actor 就在游戏世界中,它将执行您定义的 JS 功能。

this is a good idea,Thank you for your reply

from unreal.js.

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.