Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

WebGL content initialized event/callback

Discussion in 'Web' started by PhilippLe, Sep 8, 2017.

  1. PhilippLe

    PhilippLe

    Joined:
    Sep 10, 2015
    Posts:
    28
    Hello Unity community,

    I would like to initialize my WebGL content via SendMessage when the application is ready to receive those messages.
    I already tried the onRuntimeInitialized function:
    Module: {
    TOTAL_MEMORY: 268435456,
    onRuntimeInitialized: MyInitializationCallbackFunction,
    },
    without success.

    Now I'm trying to call a ready function when the gameObject is initialized via unity c# script:
    [DllImport("__Internal")]
    private static extern void isReady();

    Unfortunately now I'm getting the following error message:
    EntryPointNotFoundException: isReady.

    I'm aware of the following workaround:
    http://answers.unity3d.com/questions/1163823/entrypointnotfoundexception-when-trying-webgl-brow.html

    But this reference states that this workaroung is legacy code and may become deprecated:
    https://docs.unity3d.com/Manual/webgl-interactingwithbrowserscripting.html

    Any help will be appreciated!