[HTML5] Call C++ UFUNCTION from Webpage via JavaScript

Hello,

Is there a plugin or a general way (not emscripten) to invoke a C++ UFUNCTION() in Unreal. I would like to send some events from the page (e.g button click) into unreal html5 build that is embeded into page. Has anyone tried this, can point me in the right direction?

Cheers.

I was writing an answer until I re-read this and saw you wrote “not emscripten.”

@jonathan.madden Mate, at this point, i’ll go with emscripten, since i had a small breakthrough with it (calling javascript is easy). Can you still post your answer? for future generations at least, thanks!

The short version with a button click example is this: [Webpage Button to UFUNCTION][1]

And a totally unnecessary screenshot of the event in the blueprint graph. :stuck_out_tongue: Anything that needs to know about that event just binds to our gamemode’s dispatcher:

The long version with more examples: WebGL and Resolution Errors in HTML5 - Platform & Builds - Epic Developer Community Forums

is there a way to pass params?

Module.ccall(‘web_set_data’, null, [‘string’, ‘number’], [‘Test’, 2]);

and
void EMSCRIPTEN_KEEPALIVE web_set_data(EM_UTF8* _string, int _number){}

This works, and the same way with .cwrap to assign a C function to JavaScript like in the big text file in my linked post.

void EMSCRIPTEN_KEEPALIVE web_set_data(EM_UTF8* _string, int _number){}

Thank you! It’s stange however, that i can see methods wrapped in Module (js side) , but when i call them, there’s no response in UE4. (tried on screen messages in functions, no result, will continue trying )

Hi, you have results in pass paraemters to engine from javascripts???

This all worked in 4.13, but we’ve dropped development on our HTML5 build so I don’t know if any of this changed since then.

What do I need to include to be able to use those EMSCRIPTEN_ macros?