Unity destroying assets is not permitted

Just posting the solve for anyone getting this error, at least one option.

Declare a variable called selfRef of type GameObject. In start set selfRef = this.gameObject.

Instead of using Destroy(gameObject, maxLifeTime) use Destroy(selfRef, maxLifeTime).

1 Like

Thanks for posting this!

Privacy & Terms