[SOLVED] Adding javascript snippet

I want to add the script below in my game is it possible? its a simple integration for a cloud service i am having. Please advice.

  window.watsonAssistantChatOptions = {
      integrationID: "b0f0-66c5-4f27-9736-c40dbb64a777", // The ID of this integration.
      region: "us-south", // The region your integration is hosted in.
      serviceInstanceID: "38d10070-5c4a-4930-a82d-d77159f5dbb2", // The ID of your service instance.
      onLoad: function(instance) { instance.render(); }
    const t=document.createElement('script');

Create a new script. Add the JS code without the <script> tags. Done :slight_smile:

Basically, all the JS files in the PlayCanvas project are added to HTML document so you can add any JS code in a script file and it will be as though it’s been added as a DOM on the document.

1 Like

Hi, I added the script however, the space within the icon is not clickable as it belongs to the first person camera. is there a way to restrict a specific place in the screen for the window.

Sorry, not sure what you mean? Can you post the project url please?

I will add you to the project ok?

I’m afraid I only handle public projects otherwise I’m giving 1 to 1 support.

I added you just play the virtual space scene, try clicking on the icon found on the bottom left. This is the part I have an issue with

Are you saying that you can’t click on the bottom right icon because the first person script locks the mouse cursor ?

Yes, this is what I mean. Can you help please? Is there a way to block this space for the icon to open it

You can try to stop the event propagation when the HTML element receives the mouse down event (https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation)

Or have it so that the user has to click on a button to enter first person mode and remove the pointer lock on the first person script.

1 Like

Thanks for your clarification, I stopped locking the mouse pointer in the first person script and it worked. Thanks