Download

Call blueprint function from Javascript

I successfully deployed my game in browsers (chrome and firefox) now I would like to call a Javascript function in the browser (or in a js file that gets executed on the html page) and see things happening inside my game. For example, when I enter jump(); in browser’s console, I want to see the player jumps. I have seen Coherent GT and I don’t know if that’s a solution or not. I’m using blueprints (not very familiar with c++) by the way. Am I missing a straight-forward way to do this?

1 Like

I found How to access data / variables with JavaScript? - UE4 AnswerHub which mentions that there’s a resize callback in the Game.html.template, so you could probably look at that to see how they did it and do the same. It’s probably a little harder for blueprints than C++, but it could lead you to the answer.

Other than that, I didn’t see much at all about this, so you’re probably just trying to do something that’s too new, IMO. Nobody’s done it yet.

Having said that, it seems interesting, and I wish I had time to look into it now.

Thanks for the answer. I wanted to try ccall and cwrap before, the thing was I didn’t know how to find/put a blueprint function inside the c++ code to call it from javascript and as someone who hasn’t looked into c++ structure of games made by this engine before, it was overwhelming. are there any simple tutorials for that?

in html development, I think it’s one of the essentials. Maybe I could find a suggestion form somewhere…

Thanks for the hints. I’m getting into this now.

I want to know two things.

  1. How do you invoke an HTML5 function from Blueprints?

  2. How do you invoke Blueprints from an HTML5 function?

http://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html#interacting-with-code

1 Like

Here’s my question on answerhub, the solution works, so good luck.

https://answers.unrealengine.com/questions/555438/html5-call-c-ufunction-from-webpage-via-javascript.html

Thanks. That really helped. I have all the pieces now.

http://tagenigma.com/blog/2017/02/05/unreal-speech-plugins/

1 Like