Closed melMass closed 3 years ago
Adding this safeguard does work
if (Target.PositionMap == null) return;
But that should already be handled in the isValid function, my guess is that it's tied to the pattern you used for defining properties but as I have no clue of how it works I cannot debug it further. I'd love to know if anyone knows.
For now, I'm setting up the compute shader binding this way in the Start
function of the baker:
_compute = (ComputeShader)Resources.Load("SkinnedMeshBaker");
When you add the SkinnedMeshBaker
component to a game object, Unity Editor sets the _compute
property based on the default reference that is defined in the .meta
file.
So, it should work properly if you add the component using the Editor.
If you add the component by scripting (like AddComponent<SkinnedMeshBaker>()
), it doesn't work. In that case, your workaround suggested in the last comment makes sense.
Also can you explain briefly the logic behind using two files to define the same mono behavior (SkinnedMeshBaker.cs & SkinnedMeshBakerProperties.cs)?
I'm closing this issue now. Please feel free to reopen it for further problems.
Thank you very much!
Hi,
While trying to test Smrvfx in a project it complained about the missing reference (_compute) to the compute shader. Where are you setting the reference?
Also can you explain briefly the logic behind using two files to define the same mono behavior (
SkinnedMeshBaker.cs
&SkinnedMeshBakerProperties.cs
)? Because while in Editor there is a looping missing reference toPositionMap
here: https://github.com/keijiro/Smrvfx/blob/5160fe5e92a7e06934bab63c88f76687c6d0a0ac/Packages/jp.keijiro.smrvfx/Runtime/SkinnedMeshBinder.cs#L60