Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

FPSController/MouseLook namespace issue

Discussion in 'Scripting' started by egartnuc, Aug 26, 2018.

  1. egartnuc

    egartnuc

    Joined:
    Jun 2, 2018
    Posts:
    23
    Hello,

    Long story short: I ran into a namespace issue previously and tried solving it by copying some standard asset scripts around. Unfortunately I didn't solve it that way and now I'm just trying to reverse the damage I did.

    And I got it all back to working, almost. The following scripts I moved to my own _SCRIPTS folder. Now they are all back in place in the SA scripts folder.

    MouseLook.cs,
    FirstPersonController,
    HeadBob.

    However now I get an error in the firstpersoncontroller-script saying it can't find the MouseLook by the reference in the script. And in unity console I get the below error.

    transform.localPosition assign attempt for 'FirstPersonCharacter' is not valid. Input localPosition is { NaN, NaN, 0.000000 }.
    UnityEngine.Transform:set_localPosition(Vector3)
    UnityStandardAssets.Characters.FirstPerson.FirstPersonController:UpdateCameraPosition(Single) (at Assets/Standard Assets/Characters/FirstPersonCharacter/Scripts/FirstPersonController.cs:406)
    UnityStandardAssets.Characters.FirstPerson.FirstPersonController:FixedUpdate() (at Assets/Standard Assets/Characters/FirstPersonCharacter/Scripts/FirstPersonController.cs:292)


    The errors on 406 and 292 refer to:

    Code (CSharp):
    1.                 m_Camera.transform.localPosition =
    2.                     m_HeadBob.DoHeadBob(m_CharacterController.velocity.magnitude +
    3.                                       (speed*(m_IsWalking ? 1f : m_RunstepLenghten)));
    Afaik, I put it all back how it's supposed to be. But there is something that don't find something.

    Thankful for any ideas. Cheers.


    BR
    Tomas
     
  2. egartnuc

    egartnuc

    Joined:
    Jun 2, 2018
    Posts:
    23
    Well, then. After numerous reimports of the files I tried throwing in an FPSController prefab and run with it, just for kicks. Upon deleting it the errors in the console are gone the next time I run playmode with my controller. Though the MouseLook namespace problem in FirstPersonController script still persists, I don't get errors.

    Gonna wait a bit with marking this as solved, in case anyone has a solution for the last weirdness.