is this dead
Viewing post in Justin Gorilla Horror comments
1.
IOException: Access to the path '\\?\C:\Users\Alexc\OneDrive\Desktop\MTNBETAPROJECT (3)\Justin Gorilla Horror\Library\BuildPlayerData\Editor' is denied.
System.IO.FileSystem.RemoveDirectoryInternal (System.String fullPath, System.Boolean topLevel, System.Boolean allowDirectoryNotEmpty) (at <88e4733ac7bc4ae1b496735e6b83bbd3>:0)
System.IO.FileSystem.RemoveDirectoryRecursive (System.String fullPath, Interop+Kernel32+WIN32_FIND_DATA& findData, System.Boolean topLevel) (at <88e4733ac7bc4ae1b496735e6b83bbd3>:0)
System.IO.FileSystem.RemoveDirectory (System.String fullPath, System.Boolean recursive) (at <88e4733ac7bc4ae1b496735e6b83bbd3>:0)
System.IO.Directory.Delete (System.String path, System.Boolean recursive) (at <88e4733ac7bc4ae1b496735e6b83bbd3>:0)
UnityEditor.VisualStudioIntegration.DirectoryIOProvider.Delete (System.String path, System.Boolean recursive) (at <57a8ad0d1492436d8cfee9ba8e6618f8>:0)
UnityEditor.Build.Player.BuildPlayerDataGenerator.CreateCleanFolder (System.Boolean isEditor) (at <57a8ad0d1492436d8cfee9ba8e6618f8>:0)
UnityEditor.Build.Player.BuildPlayerDataGenerator.GenerateForAssemblies (System.String[] assemblies, System.String[] searchPaths, UnityEditor.BuildTarget buildTarget, System.Boolean isEditor) (at <57a8ad0d1492436d8cfee9ba8e6618f8>:0)
UnityEditor.Build.Player.BuildPlayerDataGeneratorNativeInterface.GenerateForAssemblies (System.String[] assemblies, System.String[] searchPaths, UnityEditor.BuildTarget buildTarget, System.Boolean isEditor) (at <57a8ad0d1492436d8cfee9ba8e6618f8>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
---------------------------
2. Error building player because script class layout might be incompatible between the editor and the player.
---------------------------
3.
Build completed with a result of 'Failed' in 13 seconds (12563 ms)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
----------------------------
4.
UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002da] in <57a8ad0d1492436d8cfee9ba8e6618f8>:0
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <57a8ad0d1492436d8cfee9ba8e6618f8>:0
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Thanks for the detailed error list. These errors are all related to Unity failing to build an APK due to file access issues and script compatibility problems. Here’s how to fix them one by one:
✅ ERROR 1: IOException - Access to path is denied
IOException: Access to the path ... \Library\BuildPlayerData\Editor is denied.
🔧 Fix:
-
Close Unity.
-
Go to this folder in File Explorer:
C:\Users\Alexc\OneDrive\Desktop\MTNBETAPROJECT (3)\Justin Gorilla Horror\
-
Delete the
Library/folder manually.-
Unity will regenerate it next time you open the project.
-
-
Make sure Unity has permission:
-
Right-click the Unity shortcut → “Run as administrator”.
-
Or move the project outside OneDrive, like to
C:\Projects\JustinGorilla.
OneDrive often causes file lock issues in Unity projects.
-
✅ ERROR 2: Script class layout might be incompatible
This means some C# scripts are not compatible between Editor and build. Usually caused by:
-
Using
[DllImport]or unsafe code. -
Using editor-only classes (
UnityEditor) in scripts that are not wrapped in#if UNITY_EDITOR.
🔧 Fix:
-
Open all scripts and search for anything like:
using UnityEditor;
-
Wrap all editor-only code like this:
#if UNITY_EDITOR // Editor-only code here #endif
-
Make sure your scripts do not use Editor-only APIs in runtime code.
✅ ERROR 3: Build completed with result 'Failed'
This is a summary error. It means one of the earlier errors (usually Error 1 or 2) caused the build to fail. Once those are fixed, this one will disappear.
✅ ERROR 4: BuildPlayerWindow+BuildMethodException: 2 errors
Again, this is just Unity saying “I couldn’t build because there were 2 earlier errors.” Solving Errors 1 and 2 will fix this.
✔️ Final Steps:
After applying all the above fixes:
-
Restart Unity.
-
Rebuild the project (
File > Build Settings > Build). -
If you're still on OneDrive, move your project to a folder not synced to cloud storage.
Let me know if you want me to review a specific script for #if UNITY_EDITOR mistakes or if more errors come up after these!