Example #1
0
    protected override void OnDestroy()
    {
//		Debug.Log("Destroying a Shape.");
        if (_handle == IntPtr.Zero)
        {
            Debug.LogError("ChipmunkShape handle is already null.");
            return;
        }

        if (CP._cpShapeGetSpace(_handle) != IntPtr.Zero)
        {
            Debug.LogError("Attempted to destroy a shape that was still added to a space.");
            return;
        }

        GCHandle gch = GCHandle.FromIntPtr(CP._cpShapeGetUserData(_handle));

        if (gch.Target != this)
        {
            Debug.Log("ChipmunkShape handle does not match");
        }
        gch.Free();
    }