void OnDisable()
    {
        //release all compute buffers
        if (allInstancesPosWSBuffer != null)
        {
            allInstancesPosWSBuffer.Release();
        }
        allInstancesPosWSBuffer = null;

        if (visibleInstancesOnlyPosWSIDBuffer != null)
        {
            visibleInstancesOnlyPosWSIDBuffer.Release();
        }
        visibleInstancesOnlyPosWSIDBuffer = null;

        if (argsBuffer != null)
        {
            argsBuffer.Release();
        }
        argsBuffer = null;

        instance = null;
    }
Beispiel #2
0
 private void Awake()
 {
     instance = this; // assign global ref using this script
 }
    //=====================================================

    private void OnEnable()
    {
        instance = this; // assign global ref using this script
    }