- Home /
Problem with Web GL Build
Hello,
I made a scene that works great in the editor, but there is something odd happening in Web GL. I have a line renderer that I redraw every fixedupdate(). The line renderer changes in vertice position count and vertice position location when other objects move in the scene, because it’s like a laser that reflects off of objects and the those objects move. I’m updating the vertice positions by creating a list and raycasting against colliders (when a collider is hit, the hit point is a vertice position), reflecting off of the colliders that allow reflection and having the final position at any collider hit that doesn’t allow reflection. Then I add the list to the SetPositions function like so SetPositions(listname.ToArray()).. The game always starts fine in Web GL, but when it is time to hit this specific object with the line renderer, the whole line disappears (and right here is the difference between the Web GL vs the editor).
The final object that is hit is using a tag which the ray cast references, so I thought maybe Web GL has issues with tags, but my player character also has a tag and when the line renderer hits him he’s destroyed as expected..
Anyways, it works fine in the unity editor, so I’m assuming it’s a web GL bug, but does anyone have any idea what could be happening in Web GL??
Is the material changing to something unsupported in WebGL maybe?
No, it has the same kind of material as every other object has in the scene, it just has a different color than the rest of the objects. I’ve never debugged a Web GL build, how would one go about debugging?
Oops, I carelessly asked before looking. Here is how to debug in Web GL https://docs.unity3d.com/$$anonymous$$anual/webgl-debugging.html
I’ll post what I find out about this.
Answer by highpockets · Jan 20, 2019 at 09:36 AM
Ok, I hate to answer my own question, but I just had a moment to debug the scene in the Microsoft edge javascript console and as originally suspected, the gameObject.tag was the problem. It threw the error, "object has undefined tag" and when I went back to unity to cross reference my added tag with other tags that ship with the project, I realized that mine had a space between the two words in the tag and others did not. So I removed the space in the tag and now it works perfect in Web GL as well.
Hope someone finds this helpful.
Cheers