Hello, i am starting with a development of a game, but right from the start i have an issue, i spend 20-40 hours trying to debug but with no success.
In the game, i have a model i am using as a cursor, it has it's own layer, it's own camera rendering to a renderTexture that is in the ui, and the UI element is mobing with the mouse. While hiding the default system mouse, it acts as THE mouse.
Everything works in the Editor Play Mode, but does not work in the actual build.
Stuff i figured out:
The UI part is fine, the texture is on the screen and camera is rendering something, indicated by the red color, that i set with this:
m_RenderCamera.clearFlags = CameraClearFlags.SolidColor;
m_RenderCamera.backgroundColor = Color.red;
The problem is not in the actual cursor object, as you can see in the screenshot, as i added a sphere primitive which is not rendering too.
There is also no probem with layers, as i set m_RenderCamera.cullingMask = ~0; and m_CursorGameObject.SetLayerRecursively(0);, the situation is the same.
Camera is pointed (in production it should only by done once, but now every update) at the cursor object like this:
Vector3 glovePosition = new Vector3(0, 2500f, 0);
m_CursorGameObject.transform.position = glovePosition;
m_RenderCamera.transform.position = glovePosition + new Vector3(1, 1, -1).normalized * 50f;
m_RenderCamera.transform.LookAt(glovePosition);
My CursorHandler class (its pseudo-monobehavior, that is constructed in another actual monobehavior method, and update called in the actual monobehavior code)
https://paste.mod.gg/nublsutxjbju/0
If anyone has any idea what could be causing this difference between editor and the build, or a different approach how to debug this, then please help 🙂
A tool for sharing your source code with the world!