Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by maxb12 · May 14, 2019 at 06:39 PM · javascriptwebglurl

WebGL - InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable

Hi there,

I want to change the url in the browser, according to several buttonNames, once the buttons are pressed.

I try to change the url via javascript with this javascriptlibrary.

QueryHandler.jslib

 var QueryHandler = {
     GetParam: function(){
     var level = "";
         var queryString = window.location.search.substring(1);
         var params = queryString.split("&");
 
         for (var i=0; i<params.length; i++) {
             var param = params[i].split("=");
             if(param[0] == "level"){ level = param[1]; }
         }
 
         //send string to Unity
         var buffer = _malloc(lengthBytesUTF8(level) + 1);
         writeStringToMemory(level, buffer);
         return buffer;
     }, 
     SetParam: function(param){
         console.log("window.location.search");
         window.location.search = "?level=" + Pointer_stringify(param);
     }
 };
 mergeInto(LibraryManager.library, QueryHandler);
 

On the buttons i have this C# script

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.SceneManagement;
 using System.Runtime.InteropServices;
 
 public class Url_manipulator : MonoBehaviour
 {
     [DllImport("__Internal")]
     private static extern string GetParam();
 
     [DllImport("__Internal")]
     private static extern void SetParam(string str);
 
     public string path;
     // Start is called before the first frame update
     void Start()
     {
         
     }
 
     // Update is called once per frame
     void Update()
     {
         
     }
 
     private void OnMouseDown()
     {
         SetParam(path);
     }
 }

It changes the Url perfectly fine, but the project unfortunatly restarts, so i see the loading screen and everything.

Also theres InvalidStateError in the mozilla console (same behaviour on chrome):

 InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable
 The script from “http://localhost:59540/TemplateData/UnityProgress.javascript” was loaded even though its MIME type (“”) is not a valid JavaScript MIME type.[Learn More] localhost:59540
 The script from “http://localhost:59540/Build/UnityLoader.js” was loaded even though its MIME type (“”) is not a valid JavaScript MIME type.[Learn More] localhost:59540
 Successfully compiled asm.js code (total compilation time 0ms)
 UnityLoader.js
 The script from “http://localhost:59540/TemplateData/responsive.javascript” was loaded even though its MIME type (“”) is not a valid JavaScript MIME type.[Learn More] localhost:59540
 Responsive WebGL Template by SIMMER.io v2019.02.08 responsive.javascript:2:5
 Available at: https://assetstore.unity.com/packages/tools/gui/responsive-webgl-template-117308 for free! responsive.javascript:3:5
 Host your WebGL Game at SIMMER.io for free! responsive.javascript:4:5
 You can reduce your startup time if you configure your web server to host .unityweb files using gzip compression. UnityLoader.js:3:8480
 [UnityCache] 'http://localhost:59540/Build/unity%20test.wasm.framework.unityweb' successfully downloaded and stored in the indexedDB cache UnityLoader.js:4:11214
 [UnityCache] 'http://localhost:59540/Build/unity%20test.wasm.code.unityweb' successfully downloaded and stored in the indexedDB cache UnityLoader.js:4:11214
 [UnityCache] 'http://localhost:59540/Build/unity%20test.data.unityweb' successfully downloaded and stored in the indexedDB cache UnityLoader.js:4:11214
 Loading player data from data.unity3d UnityLoader.js:4:9380
 Initialize engine version: 2018.3.9f1 (947e1ea5aa8d) UnityLoader.js:4:9380
 Creating WebGL 2.0 context. UnityLoader.js:4:9380
 Renderer: Mozilla UnityLoader.js:4:9380
 Vendor:   Mozilla UnityLoader.js:4:9380
 Version:  OpenGL ES 3.0 (WebGL 2.0) UnityLoader.js:4:9380
 GLES:     3 UnityLoader.js:4:9380
  EXT_color_buffer_float GL_EXT_color_buffer_float EXT_texture_filter_anisotropic GL_EXT_texture_filter_anisotropic OES_texture_float_linear GL_OES_texture_float_linear WEBGL_compressed_texture_s3tc GL_WEBGL_compressed_texture_s3tc WEBGL_compressed_texture_s3tc_srgb GL_WEBGL_compressed_texture_s3tc_srgb WEBGL_debug_renderer_info GL_WEBGL_debug_renderer_info WEBGL_debug_shaders GL_WEBGL_debug_shaders WEBGL_lose_context GL_WEBGL_lose_context UnityLoader.js:4:9380
 OPENGL LOG: Creating OpenGL ES 3.0 graphics device ; Context level  <OpenGL ES 3.0> ; Context handle 1 UnityLoader.js:4:9380
 WARNING: Shader Unsupported: 'Standard' - Pass 'META' has no vertex shader
 UnityLoader.js:4:9380
 UnloadTime: 0.000000 ms UnityLoader.js:4:9380
 Use of the motion sensor is deprecated. 9d80b04b-1533-48a2-9bd1-f8f333642324:2:228360
 Use of the orientation sensor is deprecated. 9d80b04b-1533-48a2-9bd1-f8f333642324:2:228360
 
 ​

Maybe someone is realy into this topic and help me ?! :)

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by David062 · May 29, 2019 at 09:05 AM

Which means that you can make iterables that are lazy. Calling the built-in next function on an object will attempt to call its next method prepaidgiftbalance.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

164 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to read URL parameters from Unity WebGL Build 4 Answers

Mute audio in webgl outside of the player. 0 Answers

Webgl : How to use javascript sharing function 0 Answers

Can someone help me fix my Javascript for Flickering Light? 6 Answers

How to get the game data to the Web (webgl or webplayer) 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges