Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by kromblite · Mar 27, 2016 at 10:41 PM · charactercontrollermovement script

Character controller updates less in fullscreen

I've made a simple hallway runner movement with walljumps, and when testing it in the small preview window, everything ran smoothly with no problems. However, whenever I try testing it at a higher resolution ("maximize on play" option or exported fullscreen), the character controller's movement updates less frequently. At first, I thought it was a huge framerate drop, until I put an animated part of the level onscreen and saw that it was moving at the desired framerate.

To move my character, I simply use a Vector3 called moveDirection, and use "controller.Move(moveDirection * Time.deltaTime);". Does anyone know what I'm doing wrong?

Code: float leftvelright = 0.0f; public float jumpSpeed = 10.0F; public float gravity = 30.0F; private Vector3 moveDirection = Vector3.zero; public static float runSpeed=5.0f; public static bool dead = false;

         void Update () {
             
             if (runSpeed < 20.0f) {
                 runSpeed = runSpeed + 0.05f*Time.deltaTime;
                 print (runSpeed);
             }
             
             if (dead == true) {
                 leftvelright = 0;
             }
     
             //print (leftvelright)
             
             CharacterController controller = GetComponent<CharacterController>();
     
             if (leftvelright < 5 && leftvelright >= 0 && Input.GetAxis ("Horizontal") > 0 || leftvelright > -5 && leftvelright <= 0 && Input.GetAxis ("Horizontal") < 0) {
                 leftvelright = leftvelright + (Input.GetAxis ("Horizontal") * Time.deltaTime * 50);
                 //steer
             }
             if (leftvelright <= 5 && leftvelright < 0 && Input.GetAxis ("Horizontal") > 0 || leftvelright >= -5 && leftvelright > 0 && Input.GetAxis ("Horizontal") < 0) {
                 leftvelright = leftvelright + (Input.GetAxis ("Horizontal") * Time.deltaTime * 50);
                 //reversedirection
             }
             if (Input.GetAxis ("Horizontal") == 0 && leftvelright < 0) {
                 leftvelright = leftvelright + (0-leftvelright)*10*Time.deltaTime;
                 //stop
             }
             if (Input.GetAxis ("Horizontal") == 0 && leftvelright > 0) {
                 leftvelright = leftvelright - leftvelright*10*Time.deltaTime;
                 //stop
             }
     
     
     
             if (leftvelright > 10)
                 leftvelright = 10;
             if (leftvelright < -10)
                 leftvelright = -10;
     
             if (controller.isGrounded) {
                 moveDirection = new Vector3 (leftvelright, 0, 0);
                 
                 if (Input.GetButton("Jump"))
                     moveDirection.y = jumpSpeed;
                 
             }
             moveDirection.x = leftvelright;
     
             moveDirection.y -= gravity * Time.deltaTime;
     
             moveDirection.z = runSpeed;
     
             controller.Move(moveDirection * Time.deltaTime);
         }
     
         void OnControllerColliderHit(ControllerColliderHit hit){
             if (hit.gameObject.tag == "Wall") {
     
                 moveDirection = new Vector3 (leftvelright, -1, 0);
     
                 if (Input.GetButton ("Jump")) {
                     moveDirection.y = jumpSpeed;
                     if (moveDirection.y > jumpSpeed)
                         moveDirection.y = jumpSpeed;
                     leftvelright = -leftvelright * 2.0f;
                 }
             }
         }
 
Comment
Add comment · Show 2
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 TreyH · Mar 27, 2016 at 10:57 PM 0
Share

You would typically just link the full contents of your Update() function, or w/e you were using to move it. One line doesn't really help the problem to be diagnosed.

avatar image kromblite TreyH · Mar 28, 2016 at 02:26 AM 0
Share

Apoligies, I'll edit my original post.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by kromblite · Mar 29, 2016 at 09:18 PM

Is anyone else having this problem?

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

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

Related Questions

[solved] Playermovement script 1 Answer

Player still move left&right in MenuUI 0 Answers

Most suitable way to make player move for an open world environment? 0 Answers

Character Movement bug. 0 Answers

Movement When Character is in air. 0 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