Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Obi rope cutting not accurate
#11
(31-05-2022, 12:38 PM)martymayfly Wrote: Hi Jose, 
The problem is about the shader code in AddMouseLine() method.
Code:
lineRenderer.sharedMaterial = new Material(Shader.Find("Unlit/Color"));
I don't know why but shader is null after that code.

Is this shader included in your build? (ProjectSettings->Graphics->Always Included Shaders)

Note this line of code searches for the shader, but the shader is not a reference exposed in the inspector (a public member of the class). Unity will only include resources that:

A) Are explicitly referenced by any object in the scenes added to the build.
B) Are manually included in the build.

If no other objects in your scene use this shader and it's not part of the always included shaders list, looking for it will return null in the build.

(31-05-2022, 12:38 PM)martymayfly Wrote: I created and assigned a material and it is working now.

Because the shader is now referenced by a material, and the material referenced by an object in the scene, so it's included in the build (case A) above).

(31-05-2022, 12:38 PM)martymayfly Wrote: Last question; which solver backend do you recommend for mobile games, Oni or Burst? Thanks for your support.

Burst, no doubt. Oni is always slower, sometimes considerably so (specially on Android).

kind regards,
Reply