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
0
Question by DoctorMoney · Dec 27, 2013 at 03:49 AM · charactercontrollerwarningpause gamecharacter.move

CharacterController.Move problem with pause menu

When I pause my game I get that warning popping up. I don't know if it's even worth fixing as the game itself works fine. Here's my code (that matters):

     if (Input.GetKeyDown(KeyCode.Escape))
         {
             if (pauseMenuOpen == false)
             {
                 audio.PlayOneShot(clickSound);
                 playerPosX = player.transform.position.x;
                 playerPosY = player.transform.position.y-.4;
                 playerPosZ = player.transform.position.z;
                 
                 OpenPauseMenu();
                 pauseMenuOpen = true;
             }    
     
 function OpenPauseMenu () {
 
     player.GetComponent(CharacterController).enabled = false;
         
         Time.timeScale = 0;
         Screen.lockCursor = false;
         player.transform.position = Vector3(playerPosX, playerPosY, playerPosZ);
 }

If i don't turn off the character controller and the player is moving and pauses the game it returns null values for some variables and nothing seems to fix it. The "playerPosX" variables are used to set the position of the player because unity seems to lose track of the object and assigns it a y position than what it was previously at when i turn off the character controller.

If anyone knows how to fix the CharacterController.Move called on inactive controller UnityEngine.CharacterController:Move(Vector3) problem without completely reworking my code it would be greatly appreciated. If there is no solution, is it bad to have the constant warnings like it's giving me?

Thanks

Comment
Add comment · Show 9
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 Benproductions1 · Dec 27, 2013 at 04:14 AM 0
Share

We can't help you unless you actually post the code relevant to the question. You get a warning about calling $$anonymous$$ove when you shouldn't be, so why don't you post the code where you call $$anonymous$$ove from? Or at least explain when that gets called?

avatar image DoctorMoney · Dec 27, 2013 at 04:19 AM 0
Share

@Benproductions1 What do you mean? I'm disabling the character controller while the pause menu is open and the character controller is just the standard character controller that comes with unity.

I get the error calling move on a character controller that is disabled, I'm just looking for a work around or something that makes the warning go away

avatar image Benproductions1 · Dec 27, 2013 at 04:31 AM 0
Share

Press ctrl-f, type in .$$anonymous$$ove(. Is it in the code you posted? No. Is it necessary for your question to be answered, Yes. So why not post it?

Also, why not just check whether the character controller is disabled before calling $$anonymous$$ove?

avatar image DoctorMoney · Dec 27, 2013 at 04:48 AM 0
Share

The .$$anonymous$$ove is all over the place in the Character $$anonymous$$otor, I wouldn't know how to paste it into a coherent post that everyone can understand. And I know why I'm getting the error, it's because I'm telling something to move when it shouldn't be able to and my guess is Unity is getting confused. I'm not asking for a solution so to speak because the code works but more how do I just get rid of the warning because my code isn't giving me any problems except that.

avatar image Benproductions1 · Dec 27, 2013 at 05:10 AM 0
Share

The way to get rid of the warning is to solve the problem. Now that you've finally told us how you are controlling the CharacterController, my suggestion is to disable the Character$$anonymous$$otor (and anything using it) when you disable the CharacterController. Better yet, you only need to disable the script that ultimately controls the movement.

Show more comments

2 Replies

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

Answer by DoctorMoney · Dec 29, 2013 at 01:04 AM

Fixed it, problem was I had a script that was active that depended on the Character Motor so it would always re enable itself for anyone who might look at this in the future. Check your scripts

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

Answer by jDixon793 · Dec 28, 2013 at 06:20 PM

If the Character Motor is where the move is being called maybe try disabling the script when you are paused? GetComponent<CharacterMotor>().enabled = false;

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 DoctorMoney · Dec 28, 2013 at 10:48 PM 0
Share

Tried that, it just reenables itself and keeps giving me the warning @jDixon793

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

20 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

Related Questions

Multiply deltaTime to arrive at point2 in 1.5 sec ? 1 Answer

Fail with movedirection of Character Controller 1 Answer

why does character controller accelerate off ledges? 1 Answer

Pushing a character controller (physics interaction) 0 Answers

Using .move(), the enemy moves faster at a diagonal 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