Hi everyone. I’ve been trying to build the latest version of my game since last night, but I’m not sure how to interpret or fix the errors it’s giving me.
I was able to build it a couple of days ago, so I know whatever the problem is has to be pretty recent, which makes me believe one of them is related to the script I’ve attached. Can anyone help me figure these errors out? One of them is an access to the path ... is denied
error and the other is about script class layout incompatibility.
I am on a Windows 10 PC trying to build for Android, but the Windows build failed too. I tried to cut out the code that should be unrelated because the script is pretty long, but if the rest is necessary, I’m happy to add it. Any help is appreciated, and thank you in advance!
UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002da] in <5f40cdb07bd44d76a23dad985a4ec283>:0
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <5f40cdb07bd44d76a23dad985a4ec283>:0
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Error building player because script class layout might be incompatible between the editor and the player.
IOException: Access to the path '\\?\C:\Users\vkolb\Desktop\Thunder Jumper 2.0 WIP3\Library\BuildPlayerData\Editor' is denied.
System.IO.FileSystem.RemoveDirectoryInternal (System.String fullPath, System.Boolean topLevel, System.Boolean allowDirectoryNotEmpty) (at <c2a97e0383e8404c9fc0ae19d58f57f1>:0)
System.IO.FileSystem.RemoveDirectoryRecursive (System.String fullPath, Interop+Kernel32+WIN32_FIND_DATA& findData, System.Boolean topLevel) (at <c2a97e0383e8404c9fc0ae19d58f57f1>:0)
System.IO.FileSystem.RemoveDirectory (System.String fullPath, System.Boolean recursive) (at <c2a97e0383e8404c9fc0ae19d58f57f1>:0)
System.IO.Directory.Delete (System.String path, System.Boolean recursive) (at <c2a97e0383e8404c9fc0ae19d58f57f1>:0)
UnityEditor.VisualStudioIntegration.DirectoryIOProvider.Delete (System.String path, System.Boolean recursive) (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
UnityEditor.Build.Player.BuildPlayerDataGenerator.CreateCleanFolder (System.Boolean isEditor) (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
UnityEditor.Build.Player.BuildPlayerDataGenerator.GenerateForAssemblies (System.String[] assemblies, System.String[] searchPaths, UnityEditor.BuildTarget buildTarget, System.Boolean isEditor) (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
UnityEditor.Build.Player.BuildPlayerDataGeneratorNativeInterface.GenerateForAssemblies (System.String[] assemblies, System.String[] searchPaths, UnityEditor.BuildTarget buildTarget, System.Boolean isEditor) (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
public class Accelerometer : MonoBehaviour
{
public float test = 1f;
void Update()
{
float movement = touchInput * speed;
rb.velocity = new Vector3(movement, rb.velocity.y, 0);
if (Input.touchCount > 0)
{
touchPosWorld = Camera.main.ScreenToWorldPoint(Input.GetTouch(0).position);
Vector2 touchPosWorld2D = new Vector2(touchPosWorld.x, touchPosWorld.y);
touchPosWorld = Camera.main.ScreenToWorldPoint(Input.GetTouch(0).position);
RaycastHit2D hitInformation = Physics2D.Raycast(touchPosWorld2D, Camera.main.transform.forward);
if (hitInformation.collider != null)
{
Debug.Log("Touched " + EventSystem.current.currentSelectedGameObject.name);
}
if (allowMovement)
{
if (EventSystem.current.currentSelectedGameObject.name == "LeftArrow")
{
rb.velocity = new Vector3(-speed, rb.velocity.y, 0);
}
else if (EventSystem.current.currentSelectedGameObject.name == "RightArrow")
{
rb.velocity = new Vector3(speed, rb.velocity.y, 0);
}
else if (Input.GetTouch(0).phase == TouchPhase.Ended)
{
rb.velocity = new Vector3(0, rb.velocity.y, 0);
}
}
if ((Input.GetTouch(0).phase == TouchPhase.Began) || (Input.GetTouch(1).phase == TouchPhase.Began))
{
if (grounded == true && !dead)
{
sound.Play();
rb.AddForce(new Vector3(0, jumpForce, 0));
}
if (myWire != null && !dead)
{
myWire.Bounce();
}
}
}
deathTimer -= deathTimerIncrement * Time.deltaTime;
if (deathTimer <= 0)
{
Die();
}
advanceTimer -= advanceTimerIncrement * Time.deltaTime;
if (advanceTimer <= 0)
{
Advance();
}
if (!dead)
UpdateSprite();
}
public void AllowMovement(bool movement)
{
allowMovement = true;
}
private void FixedUpdate()
{
if (rb.velocity.y < gravityKicksInVelocity)
{
rb.velocity += Vector2.up * Physics2D.gravity.y * (fallMultiplier - 1) * Time.deltaTime;
}
else if (rb.velocity.y > 0 && Input.GetTouch(0).phase == TouchPhase.Ended)
{
rb.velocity += Vector2.up * Physics2D.gravity.y * (lowJumpMultiplier - 1) * Time.deltaTime;
}
}
Hi, did you ever found out what happened? I was busy with my Android project and suddenly it pops up with 26 build errors out of nowhere, among them the same error as yours... > Error building player because script > class layout is incompatible between > the editor and the player.
– Lucie