- Home /
How come I can't move in the built version of my game?
I decided to try out a build of the game (an FPS) on my PC, and to see what the requirements for the game would be so far. (by using VMWare player)
However, I came across a problem... I can't move.
The player starts off above the ground, I did this to test the gravity, and I stay in the air!
The mouse and the shooting, but I can't move and the gravity is non existent.
I'm also getting this error in the log on the bottom-left: "Gamename/Gamename_Data/mainData is corrupted! Remove it and launch unity again! [Position out of bounds! 34308 > 34304]".
How do I fix this problem?
Also, how can I get rid of the mouse pointer in the game build?
EDIT: The problem seems to be the FPS Input Controller script I have, because all the thing I couldn't do in the build is handled by this script, here's the code (It's in C#): using UnityEngine; using System.Collections;
public class FPSInputController : MonoBehaviour {
public float speed = 100;
public float jumpSpeed = 0;
public Vector3 moveDirection = Vector3.zero;
public float gravity = 200;
public bool grounded = false;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update ()
{
if (grounded)
{
moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
moveDirection = transform.TransformDirection(moveDirection);
moveDirection*= speed;
}
if (grounded)
{
if(Input.GetButtonDown("Jump"))
{
moveDirection.y = jumpSpeed;
}
}
moveDirection.y -= gravity * Time.deltaTime;
var controller = GetComponent<CharacterController>();
var flags = controller.Move(moveDirection * Time.deltaTime);
grounded = (flags & CollisionFlags.CollidedBelow) !=0;
}
}
mouse cursor can be removed using Screen.showCursor = false;
Without any information on what you did, it is quite hard to say why it doesn't work. Also, did you do what the log is telling you?
How are you moving your player? Is it working if you play the game in editor?
At least for the last question I can give you an answer:
void Start() {
Screen.showCursor = false;
}
I did what the eror told me, and it wouldn't run at all after that.
I made a script to control the character, I followed this tutorial: http://www.youtube.com/watch?v=XdXrxvWgvYo&list=PL$$anonymous$$OB0XbHFIvnNQ4VYPa73x$$anonymous$$v2ip03Wqbh∈dex=1
I don't think this is the problem, because the built in controller script didn't worth either.
The mouse script worked just fine, though, thanks!
Of course it doesn't work after deleting the GameData folder. You have to make a new build first.
what about WITHOUT V$$anonymous$$Ware Player? my guess is that this is the culprit, but I don't have any experience with V$$anonymous$$Ware..
Answer by Cobradabest · Jan 08, 2013 at 05:12 PM
It's okay, I fixed it, it turns out that a couple of scripts were corrupt, I created new ones, and copied the codes, now they work!
Thanks ExTheSea!
Can you tell me what scripts you edited to fix that error because Im getting the same error and I have no idea what script is messing my whole project up.
Hey Jack. It can be a different script in your case. You have to look which script isn't working (for example using Debug.Log) and then you can try making a new one and copying the code but i would guess it should be really obvious. In my case my camera was freaking out the second my Player spawned. The reason was that my $$anonymous$$ouseLook-Script was corrupt. You just have to look what exactly is acting weird and which script mainly has something to do with it. Good luck finding the script.
Your answer
Follow this Question
Related Questions
Weird game-output! 1 Answer
Mac build closing on start, Windows version works (permissions problem?) 1 Answer
Blue Screen On Windows Build 0 Answers
,Unity 2019.2 build stuck on scene 0 0 Answers
Build Fails In Unity 3.0 4 Answers