Skip to content

Instantly share code, notes, and snippets.

@instance-id
Last active July 12, 2022 03:52
Show Gist options
  • Save instance-id/53dddaba6bf80f9db0f5b8f85da708ef to your computer and use it in GitHub Desktop.
Save instance-id/53dddaba6bf80f9db0f5b8f85da708ef to your computer and use it in GitHub Desktop.
Unity GenerateAuthoringComponent error for Entities 0.51 helper
using System.IO;
using UnityEditor;
using UnityEngine;
namespace instance.id.Editors
{
// --| Place this in an Editor folder and press Ctrl+Alt+R
// --| Will remove "GeneratedCode" folder and recompile
public static class RefreshGeneratedSource
{
[MenuItem("Tools/RefreshGeneratedSource %&r")]
public static void resetGeneratedCode()
{
var generatedCodePath = Path.Combine(Application.dataPath, "../", "Temp/GeneratedCode");
var resolvedPath = Path.GetFullPath(generatedCodePath);
Debug.Log($"Removing: {resolvedPath}");
if (Directory.Exists(resolvedPath))
Directory.Delete(resolvedPath, true);
EditorUtility.RequestScriptReload();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment