Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
1
Question by Hotshot10101 · Jun 29, 2013 at 06:39 AM · maccharacter controllerpc

Character Controller PC versus Mac Problem

I have a character controller on my player object. I have my own script that I use to move it. It is very simply. Here are the entries on the controller:

slope limit 45, step offset .1, skin width .1, min move 0, center 0,0,0, radius .5, height 1.3.

Here is the script I use to move it:

 using UnityEngine;
 using System.Collections;
 
 [RequireComponent(typeof(CharacterController))]
 public class MovementScript : MonoBehaviour
 {
     public bool Enabled { get; set; }
     
     public float f_speed;
     public float f_gravity;
     
     private CharacterController controller;
     private Vector3 moveDirection = Vector3.zero;
     
     void Start ()
     {
         controller = GetComponent<CharacterController>();
         Enabled = true;
     }
 
     void Update ()
     {
         if (Enabled)
         {
             if (controller.isGrounded)
             {
                 moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
                 moveDirection = transform.TransformDirection(moveDirection);
                 moveDirection *= f_speed;
 
             }
     
             moveDirection.y -= f_gravity;
             controller.Move(moveDirection * Time.deltaTime);
         }
     }
 }

When I build this on my Mac everything works perfect. If I build an output PC.exe file and run it on the PC then the player tries to go straight up in the air instead of any other direction.

On the Mac if I hit W the character goes forward, S he goes backward, A he slides to the left and D to the right. As I said, he works perfect.

If I build for PC and run it on a PC then he ALWAYS goes UP instead of the direction like on the Mac.

If I open Unity and open the project on the PC I get the same bad results running in the editor. I have added logging on the PC to see if the horizontal and vertical values are correct and they are.

I am running the same version of Unity on the Mac and PC.

What the heck is going on?

EDIT: I just uploaded a test project that demonstrates the problem: Test Project If you Play it on Mac it works fine. If you Play it on Windows it doesn't move as it should.

I also have built a web player version of it. If you go to this on a Mac it works fine. If you try it on Windows it doesn't work. I use Chrome on both. Here is the link: http://www.shatalmic.com/cctest

charactercontrollertest.zip (111.8 kB)
Comment
Add comment · Show 3
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 robertbu · Jun 29, 2013 at 06:56 AM 0
Share

Shot in the dark. Does your PC have a game controller or other device that could be mapped to "Horizontal" or "Vertical?"

avatar image Hotshot10101 · Jun 29, 2013 at 06:58 AM 0
Share

Thank you for the try, but no. It is like there is just some setting or bug that ignores the input vector and always makes the character go straight up.

avatar image Benproductions1 · Jun 29, 2013 at 07:30 AM 0
Share

very strange bug

2 Replies

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

Answer by Hotshot10101 · Jul 04, 2013 at 05:29 PM

I received a reply from Unity QA saying they were able to reproduce the issue and to watch for an update in the release notes of future updates to Unity. Guess I will have to wait and see.

Comment
Add comment · Show 1 · 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 nomadic · May 14, 2014 at 02:12 AM 0
Share

Did you ever find a solution to this bug? I'm having a very similar problem. I even moved the whole project to my PC and the issue still occurs in the editor.

In Windows, my Character Controller only moves in -X/-Y/-Z. Sometimes moves +X/+Y like it is dragging through mud, and never moves +Z. It correctly moves in all directions on $$anonymous$$ac. Really puzzling.

avatar image
0

Answer by jococo · Oct 06, 2016 at 06:54 AM

was this ever fixed or is there a work around? Using Unity 5.4.0.

Comment
Add comment · 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

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.

Follow this Question

Answers Answers and Comments

18 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 avatar image avatar image avatar image

Related Questions

iPhone development in Unity 3.0 using PC + MAC? 1 Answer

A node in a childnode? 1 Answer

PC and Mac builds FPS different? 2 Answers

Cannot find dll file in Unity folder (Mac) 1 Answer

Stop the dialogue box from appearing on PC/Mac builds 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges