Skip to content

Instantly share code, notes, and snippets.

@Rovsau
Last active April 7, 2023 23:02
Show Gist options
  • Save Rovsau/9caf7201b301e10fbeb576ac2e50fa07 to your computer and use it in GitHub Desktop.
Save Rovsau/9caf7201b301e10fbeb576ac2e50fa07 to your computer and use it in GitHub Desktop.
Make scripts delete themselves.
public class Voltorb
{
// Uncomment at your own risk.
//[UnityEditor.InitializeOnLoadMethod]
private static void SelfDestruct([System.Runtime.CompilerServices.CallerFilePath] string path = "")
{
path = System.IO.Path.GetRelativePath(System.IO.Directory.GetCurrentDirectory(), path);
//UnityEditor.AssetDatabase.DeleteAsset(path);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment