MeshToSDF icon indicating copy to clipboard operation
MeshToSDF copied to clipboard

crashing when changing scene or hit play

Open Levrden opened this issue 5 years ago • 0 comments

Hi ! You wonderfull script has a problem for me... Whenever i hit play or i open another scene, i get this error messages

IndexOutOfRangeException: Invalid kernelIndex (1) passed, must be non-negative less than 2. UnityEngine.ComputeShader.SetTexture (System.Int32 kernelIndex, System.String name, UnityEngine.Texture texture) (at C:/buildslave/unity/build/Runtime/Export/Shaders/Shader.cs:637) MeshToSDF.MeshToVoxel (System.Int32 voxelResolution, UnityEngine.Mesh mesh, UnityEngine.Vector3 offset, System.Single scaleMeshBy, System.UInt32 numSamplesPerTriangle, UnityEngine.RenderTexture voxels) (at Assets/MeshToSDF/MeshToSDF.cs:180) MeshToSDF.Update () (at Assets/MeshToSDF/MeshToSDF.cs:81)

Attempting to bind Texture ID 1187 as UAV, the texture wasn't created with the UAV usage flag set! UnityEngine.ComputeShader:SetTexture(Int32, String, Texture) MeshToSDF:MeshToVoxel(Int32, Mesh, Vector3, Single, UInt32, RenderTexture) (at Assets/MeshToSDF/MeshToSDF.cs:180) MeshToSDF:Update() (at Assets/MeshToSDF/MeshToSDF.cs:81)

What I have in line 81 outputRenderTexture = MeshToVoxel(sdfResolution, mesh, offset, scaleBy,

in line 180 MtVImplementation.SetTexture(Zero, "Voxels", voxels);

the only thing that i can do is to delete the MeshToSdf prefab on the scene and re-enter all the settings again.

I have to tell you that i have added [ExecuteInEditMode] at the beginning to see it working And the problem seems not to be there on the Demo Scene

Do you have any idea of the problem ?

Thanks

Levrden avatar Jul 17 '19 20:07 Levrden