Unity3DRuntimeTransformGizmo
Unity3DRuntimeTransformGizmo copied to clipboard
Web GL performance
Good evening,
I've integrated the gizmo into my project (just need it for a simple use case) and everything works just fine while trying it out in the Unity Editor... however, when I built the project (it's a WebGL project), the moment the Gizmo shows up fps just drop like crazy making the app unusable. While testing on the editor, the performance hit is minimal, maybe 0.1-0.2 ms.
Any clue what might be causing that? I'm kind of clueless to be honest.
Thanks.
hey =), not sure, but maybe its related to the problem this person posted relating to GL class on WebGL https://forum.unity.com/threads/webgl-build-performance-issue-after-upgrade-to-2018-3.678658/ Does trying this on an earlier version of unity remove the lag? I did add the ability to use your own meshes for the gizmo instead of using the GL lines, but it was just quickly put together so it might not be great or have all the features. You would need to use the TransformGizmoCustomGizmo https://github.com/HiddenMonk/Unity3DRuntimeTransformGizmo/blob/master/Assets/RuntimeGizmo/Custom/TransformGizmoCustomGizmo.cs I gave a full example in a zip file that can be found here, but its not up to date https://github.com/HiddenMonk/Unity3DRuntimeTransformGizmo/tree/customGizmo
However, ideally we would want to know if this is something unity did and if there is a way to fix it.
Thank you very much for your reply.
I tried using the custom gizmos and it works just fine, so you were right, it was the use of the GL class.
There is one weird thing though: there is another part of the project where I use GL lines and they are causing no problems whatsoever.
Perhaps your use of GL is kind of intensive? or you're using it in a more advanced way (calling other functions) that causes the compatibility issue?
I dont think I am doing anything too crazy, but my knowledge on this isnt much =(, maybe post your gl code if its not much so we can see if I am doing anything extra that might not be needed.
I am facing the same issue in a webgl project. the frame rate drops to 1-2 fps using Unity 2019.1.7 and 2019.2.3
Hey, I had the same problem and I fixed it by writing this: if (lines.Count == 0) return;
at the start of the following functions:
void DrawLines(List<Vector3> lines, Color color)
void DrawTriangles(List<Vector3> lines, Color color)
void DrawQuads(List<Vector3> lines, Color color)
void DrawCircles(List<Vector3> lines, Color color)
So you don't do a GL.Begin
if there is no need to.
This functions are at the end of the script TransformGizmo.cs
Hope this helps :)
I have added the lines.Count check, hopefully it fixes the problem for now =), thank you!
works super smooth in WebGL build as of 2020.2. Awesome job! Thank you!