• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Cobradabest · Jan 03, 2013 at 07:03 PM · errorbuildbuild-errorstandalonedevelopment

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;
     }
 }
 
Comment
Add comment · Show 24
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image shigidaMark · Jan 03, 2013 at 07:05 PM 0
Share

mouse cursor can be removed using Screen.showCursor = false;

avatar image Piflik · Jan 03, 2013 at 07:11 PM 2
Share

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;
 }
avatar image Cobradabest · Jan 03, 2013 at 07:22 PM 0
Share

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&index=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!

avatar image Piflik · Jan 03, 2013 at 07:25 PM 0
Share

Of course it doesn't work after deleting the GameData folder. You have to make a new build first.

avatar image Seth-Bergman · Jan 03, 2013 at 07:35 PM 0
Share

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..

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

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!

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Jack423 · Apr 30, 2013 at 02:50 AM 0
Share

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.

avatar image ExTheSea · Apr 30, 2013 at 04:13 PM 0
Share

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

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

15 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Weird game-output! 1 Answer

Error: System.IO.FileLoadException: Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information. 0 Answers

"Error building Player" WebGL build error 2 Answers

WindowsPlayer Error when building project 1 Answer

1 exception was raised by workers: See the Console for details. 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges