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 N-Dream-AG · Apr 10, 2017 at 08:21 AM · webglexceptionfindwithtag

GameObject.FindWithTag throws an exception since updating to Unity 5.6, but only in WebGL export, not in Editor

I updated my project to Unity 5.6.0f3 last week, without changing anything else about the project.

In some scenes, I search for a GameObject by tag when the scene is loaded. Ever since updating to 5.6, this throws an exception once exported to WebGL. It works as intended in the editor, however.

I'm currently catching the exception and looping and waiting until I find the GameObject, but it never finds it: (Sorry for the hideous code, I added a lot of logs to see where it gets stuck in the build)

         GameObject glwGO;
         GameLogicWorld glW;
 
         yield return new WaitForSeconds(0.5f);
         
         while (glW == null) {
             Debug.Log("A: glw is null, looping to try and find it");
             try {
                 glwGO = GameObject.FindWithTag ("GameLogic");
                 Debug.Log("B: tried finding glwGO, found: " + glwGO.name);

                 glW = glwGO.GetComponent<GameLogicWorld> ();
                 Debug.Log("D: tried finding glW, found: " + glW.name);
             }
             catch {
                 Debug.Log("E: Caught exception");
             }
 
             Debug.Log("F: Waiting 0.2s");
             yield return new WaitForSeconds(0.2f);
             
         }

 

In the editor, all of this works. It takes a few loops to find the GameLogicWorld script, but it finds the object and all components on it.

(The reason why it takes several loops is that I call the Coroutine already before the scene is fully loaded)

In the build however, I never even get the Debug Log "B", an exception is thrown at GameObject.FindWithTag, and then the loop goes on until forever, never finding the object, always throwing exceptions.

I know that issues with FindWithTag can arise from the game objects simply not being there, but since the GameObject clearly exists in my scene when I test in the editor, I'm confused.

  • Did anything change about the GameObject.FindWithTag() call in Unity 5.6? I could not find anything about this.

  • Does the FindWithTag() call throwing an exception definitely mean that the object I'm searching for doesn't exist? Since it exists in the editor, what can I do to find out what happens to the GameObject?

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 Schubkraft · Apr 10, 2017 at 08:31 AM

Afaik nothing changed, please file a bug report as explained under https://unity3d.com/unity/qa/bug-reporting

Comment
Add comment · Show 3 · 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
avatar image N-Dream-AG · Apr 10, 2017 at 01:12 PM 0
Share

I tested more in depth and in empty projects and other scenes and there the FindWithTag call works in both editor and build. Should I still file a report on the issue of this exception being thrown in the build but not the editor?

avatar image Schubkraft ♦♦ N-Dream-AG · Apr 10, 2017 at 01:37 PM 0
Share

Yes if you can attach a project that reproduces the issue.

avatar image N-Dream-AG Schubkraft ♦♦ · Apr 11, 2017 at 11:43 AM 0
Share

I've been able to recreate the issue in an otherwise empty project and have filed a bug report. I will edit my original post in case I get any news. Thank you.

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

68 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

Related Questions

Retrieving Data from websocket for Unity WebGL game leads to an exception : “Uncaught RuntimeError: memory access out of bounds at wasm-function” 1 Answer

when build to webGL 0 Answers

FindWithTag returns NullReferenceException 0 Answers

exception thrown: RuntimeError: index out of bounds 1 Answer

WebGl build throw numbers (maybe assembly pointers) 0 Answers


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