Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Editor hangs when changing float field used in a ComputeShader which outputs a ComputeBuffer

Discussion in 'Shaders' started by tossrock, Jul 17, 2018.

  1. tossrock

    tossrock

    Joined:
    Mar 7, 2018
    Posts:
    12
    I have a set of ComputeShaders which have several values set on them by a managing C# script. The values are exposed as public variables which can be set by dragging in the editor view. The ComputeShaders return data via a ComputeBuffer (the data being a 7200 long array of Vector3s).

    If I am reading from the ComputeBuffer, and also changing the value of the public fields via sliding, then editor will hang, sometimes for multiple seconds. It won't hang if the value of the field is changed in by code, even if it's changing continuously each frame. It won't hang if the ComputeBuffer isn't being read from. Perhaps most frustrating is the fact that the Profiler window doesn't seem to notice that the FPS went to 0 for several seconds, and so offered no insight into what was happening. I was only able to isolate the problem through tediously applying incremental changes between the good and bad commits. I have a public repository which demonstrates this behavior.

    Can someone please explain why this is happening, or what to do about it?