Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Component property initialization in WebGL...

Discussion in 'Getting Started' started by simulationista, Jan 24, 2023.

  1. simulationista

    simulationista

    Joined:
    Dec 15, 2022
    Posts:
    1
    I have a prefab game object that is used to configure and control my application, and its components have configuration fields that control how the application subsequently runs. For example, one of its component has a field that identifies the name of a JSON file that is to be processed when the application starts.

    In my primary scene, I have an instance of this prefab configured with the path to the JSON file. If I run the application from within the Unity editor, this value is honored and the JSON file can be read in. So far, so good.

    However, when I run the application as a WebGL application, the value of the this field is empty, and so the JSON file is not processed.

    Why does the value of the JSON file field, specified for the instance in the scene, not used when the WebGL application is executed? How can I provide this value, preferably supplied by the user, when the WebGL application runs?