ClientSim icon indicating copy to clipboard operation
ClientSim copied to clipboard

[1.2.2] LineRenderer.BakeMesh failing unexpectedly

Open techanon opened this issue 3 years ago • 2 comments

When trying to create a mesh from a LineRenderer, in ClientSim the behavior is crashing upon calling line.BakeMesh(mesh, true);. This call works fine in-game via build and test. I think CS is trying to force use the 3 param override BakeMesh(Mesh, Camera, bool) instead of the 2 param method because the failure mentions Camera being null: image

techanon avatar Aug 24 '22 05:08 techanon

I have been having the same issue when working with QVPen. At first, I thought it broke on my end, but it turned out to just be ClientSim. Definitely an issue!

Hunterk1241 avatar Oct 28 '22 05:10 Hunterk1241

This is because 2 param overload of LineRenderer.BakeMesh(Mesh, bool) internally references Camera.main, which does not exist in ClientSim because no active camera is tagged with MainCamera while ClientSim session.

I suppose overriding the tag of PlayerCamera object in Packages/com.vrchat.clientsim/Runtime/Resources/ClientSim/Prefabs/ClientSimPlayerLocal.prefab with MainCamera should fix this problem, which should have no side effects as long as Camera.main and GameObject.FindGameObjectWithTag("MainCamera") are not exposed to Udon, and LineRenderer.BakeMesh(Mesh, bool) is working in-game anyway.

kaikoga avatar Apr 24 '23 09:04 kaikoga