Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Question Starter Asset Prefab jumps infinitely

Discussion in 'Prefabs' started by ANNOProfi, Jan 31, 2022.

  1. ANNOProfi

    ANNOProfi

    Joined:
    Feb 2, 2020
    Posts:
    6
    I have imported the Starter Asset - Third Person Character Controller into my project, everything works fine. Then I copy pasted everything from the Player prefab to another character, to see if it works.
    The 2D movement, i.e. walking, sprinting works fine, ramps etc. too, but if the character jumps, it never comes down and just keeps repeating the jump animation. Additionaly, if the character walks of an endge, it floats down slower than the prefab and without the falling animation.

    Since everything is copied over, is it an issue with a script, or is something important missing?
     
  2. ANNOProfi

    ANNOProfi

    Joined:
    Feb 2, 2020
    Posts:
    6
    Here is the prefab's configuration: Unity-Bug-1.PNG Unity-Bug-2.PNG
     
  3. ANNOProfi

    ANNOProfi

    Joined:
    Feb 2, 2020
    Posts:
    6
  4. Nos4r2

    Nos4r2

    Joined:
    Jun 7, 2020
    Posts:
    1
    ANNOProfi, have you solved this issue yet as I have the same problem. I note that the Grounded and Jump parameters are both ticked in the animator, but I am not sure why the code works for the stater asset armature, but not for my prefab.
     
    bhoffman67 likes this.
  5. bronsonzgeb

    bronsonzgeb

    Unity Technologies

    Joined:
    Aug 10, 2020
    Posts:
    101
    I suspect it has to do with the layers on the new Game Object. The system uses the layers to determine which colliders are part of the ground and which are part of the character itself. upload_2022-5-31_8-59-32.png

    There's a field on the Third Person Controller to specify which layers are considered Ground Layers. I suggest moving the new Character to its own Layer called something like "Character".
    upload_2022-5-31_9-1-4.png
     
    ODU, NexoYT, Marou1 and 1 other person like this.
  6. bhoffman67

    bhoffman67

    Joined:
    May 14, 2022
    Posts:
    18
    yup, this works.
     
    Last edited: Jun 18, 2022
    ODU likes this.
  7. BetaMark

    BetaMark

    Joined:
    Sep 27, 2014
    Posts:
    229
    I also stumbled into this behavior when importing the standard asset into an existing project to do some quick scene prototyping. Debugging this definitely broke my "quick prototyping" flow.

    Perhaps Unity could add a check into Awake() of the Ground Layers -vs- the "Player" tagged object's layer to LogWarning the developer if their player GO layer is in the GroundLayers layer mask?

    This is what I've added to my FirstPersonController.cs

    Code (CSharp):
    1. if (GroundLayers == (GroundLayers | (1 << gameObject.layer))) {
    2.     Debug.LogWarning($"WARNING: Player layer {LayerMask.LayerToName(gameObject.layer)} is also in the GroundLayers. Jump will go forever. ", gameObject);
    3. }
     
  8. Mohankjds

    Mohankjds

    Joined:
    Jul 27, 2021
    Posts:
    1
    CHanging Layer of Player Armeture helped. It was empty when I imported.
     
    igor_stojanovic0101 likes this.