☑ How to send the variable from HTML to PlayCanvas

The Fire from HTML does not reach to the JS of PlayCanvas.

Tested project is above.

The Fire from the other entity in PlayCanvas works fine.

I was referring to the above-mentioned.

HTML code is the following:

    <meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no' />
    <meta charset='utf-8'>
    <link rel="stylesheet" type="text/css" href="styles.css">
    <link rel="manifest" href="manifest.json">
    <script src="playcanvas-stable.min.js"></script>
        ASSET_PREFIX = "";
        SCRIPT_PREFIX = "";
        SCENE_PATH = "454899.json";
            'alpha': false,
            'preserveDrawingBuffer': false
        SCRIPTS = [ 4922381, 4922444 ];
        CONFIG_FILENAME = "config.json";
        pc.script.legacy = false;
    <script src="__start__.js"></script>
    <script src="__loading__.js"></script>

	<script type="text/javascript">
	    var app = pc.Application.getApplication();
		app.fire("setParams", "TEXT is SENT from HTML.");


What is the problem?


Most likely the script assets have not been loaded yet. Try changing your code to

var app = pc.Application.getApplication();
app.on(‘initialize’, function () {
app.fire(‘setParams’, …);

The initial order of events that are fired when the app is starting is: start, initialize, postInitialize.

Thank you, vaios.

It works fine!

I remember it.

Thanks a lot.