LightShafts 'failed getting triangles' error at runtime on Unity 5.1.1
Closed this issue · 2 comments
rmattson commented
I'm seeing the following error when adding light shafts to a spotlight, using Unity 5.1.1:
Failed getting triangles. Submesh topology is lines or points.
UnityEngine.Mesh:get_triangles()
LightShafts:InitSpotFrustumMesh() (at Assets/LightShafts/LightShafts.Resources.cs:219)
LightShafts:InitResources() (at Assets/LightShafts/LightShafts.Resources.cs:287)
LightShafts:OnRenderObject() (at Assets/LightShafts/LightShafts.cs:208)
Line 219 of LightShafts.Resources.cs is:
if (m_SpotMesh.triangles == null || m_SpotMesh.triangles.Length != 36)
And I found that adding another check to the beginning of that if statement seemed to sort it out:
if (m_SpotMesh.GetTopology(0) != MeshTopology.Triangles || m_SpotMesh.triangles == null || m_SpotMesh.triangles.Length != 36)
This does fix the error, though I'll leave it up to @robertcupisz as to whether it's the correct fix.
Agilethief commented
Thanks @rmattson worked a charm, was going to post a bug myself about it but your solution seems to be working great.
robcupisz commented
Fixed a while ago ;)