Forum rules - please read before posting.

Player switching bigissue

Hi, i'm trying to use player switching so that a female/male character can be chosen before game starts
unity 2021.3.3f1 AC 1.76.1

I've created the second character exactly with same parameters as first one, only graphic change, but it doesn't work.
if i use second player, walk animations won't work and above all it will not move correctly, trying to avoid objects like NPC and others on screen (it will also go around in a circle even walking outside the path!) but everything like NPC avoid is disabled and every parameter is exactly the same as main character! I'm getting crazy andcannot find the issue....

«1

Comments

  • If you disable player-switching, and assign the second character in the Settings Manager's "Player prefab" field, do they have the same issues then?

    Check the Console window at this time for any related messages. Check also that the character's sprite object has a local position of (0,0,0).

    I'll need to see a screenshot showing the specific issue occuring, as well as the Inspector for the character's root + sprite child.

  • Thanks for your precious support. Good idea, i tried and can confirm that disabling Multiple Players and using that prefab everything works correctly... :neutral:
    As soon as i can i send you pics, but at this point shouldn't be something related to players...

  • here you are:
    image

    image

    image

    image

  • Temporarily remove the Rigidbody 2D component, and re-enable Player-switching.

    What does the Console display, and what is the exact issue that occurs? A screenshot or video may be best, if possible.

    Are you running any Actions that affect the player, i.e. Player: Constrain or Engine: Manage systems? Test also the result of making the second Player the default.

  • Dear Chris, i've sent an emal/we transfer with 2 videos attached with object "Secon player issue"
    Thanks in advance

  • edited August 2023

    Received, thank you - though I will also need to know the results of the above as well.

    In the two test videos you've sent (working vs non-working), how to the Inspectors of the character's root compare? It looks like a collision issue, with the character colliding with an invisible circle around the NPC - is there such a Collider in the scene?

    As you're using an old release, backup/duplicate the project and import v1.78.3 - any change?

  • edited August 2023

    Ok found first issue. I disabled the box collider 2d from Guard Hotspot and now i'm able to pass and blocked by the next hotspot collider. That's weird.
    However animations won't work. Look at the console, above all the sentence "Cannot play animation walk_U (layer 0) on character grace's Animator, Grace"
    There's no walk_U animation in animator. That animation is in the other character.

  • edited August 2023

    Indeed, I saw the message - we need to compare the Inspectors of the character's root, to understand what might be going on.

    Your video showed the issue occuring when Grace is a local Player - was this with Player-switching disabled, and is the Player Inspector set with the correct animation names while in Edit mode? If so, are any Actions running that may affect the animation - i.e. Character: Animate?

    Have you tried the latest release in a duplicate project?

  • Hi, i've sent 2 videos, one with player switching enebled, one off. When the player switching is off you can see Grace moving and animating correctly
    There are no actions affecting animation. I put screenshot of animator:
    image

    Here is the root inspector of Will, along with his animator:

    image

  • forgot to mention, yesterday i updated to latest Adventure Creator asset

  • edited September 2023

    Though it shouldn't be necessary, the quick-fix would be to rename Grace's Animation states to match Will's, i.e. "idle_D" etc. You wouldn't need to rename the Animation Clip assets - just the state names within the Animator, as well as remove "grace" from the animation names in the Player Inspector.

    Does this occur when Player-switching is enabled, but Grace is the default Player? Or only when switching at runtime?

    It's the root Player Inspectors, comparing Edit mode vs Play mode, that I need to see. Could you PM me a .zip or .unitypackage of your Managers, Grace/Will's prefabs, and their Animators? If it requires Grace to be switched to at runtime, let me know also how to do this.

    If the issue occurs in a fresh scene, that should be all. If it only occurs in an existing scene, I'll need that as well.

  • Renaming did not solve. This occur with player-switching enabled when using Grace only. I have a beginning scene where you switch player before starting.
    Even if i start from the scene with Frace as default player, won't work. I'll send you all, scene and prefab as soon as possible thanks!

  • In the sample scene sent, you'll find the guard hotspot box collider disabled, re-enable to see the issue occur

  • Package received, thanks.

    Renaming did not solve.

    Grace's Player Inspector doesn't have the correct animation names - these will need to match up with the states listed in the Animator, and the names are case-sensitive.

    Renaming "idle" to "Idle", "walk" to "Walk" etc causes the warnings to disappear on my end.

    In the sample scene sent, you'll find the guard hotspot box collider disabled, re-enable to see the issue occur

    Make sure that the Guard's Circle Collider is reduced such that it's only around the NPC's feet, and that their Hotspot's Box Collider only covers their visible sprite, with "Is Trigger" enabled.

    The collision occurs because your Player, Grace, has a Rigidbody 2D attached. This may not be strictly necessary if your game is point-and-click. If you enabled "Character evasion" on your NavMesh, characters will avoid NPCs automatically using their Circle Colliders - allowing Rigidbody components to be removed for this behaviour.

  • Strange, i have tried many times, checked now and my names are the same, with capital letters and not working. Look;
    image

    Also, the Guard hotspot has a Collider reduced and Character evasion is disabled in my navmesh

  • removed rigid body and did not work :(

  • edited September 2023

    Having made the changes to the animation names, what messages now appear in the Console - and are you applying those changes back to the original prefab?

    removed rigid body and did not work

    What's the exact behaviour having done that? Is Grace still seemingly "blocked" by the Guard's collider?

  • aving made the changes to the animation names, what messages now appear in the Console - and are you applying those changes back to the original prefab?>

    Prefab and animation names in the animator are the same. In fact, if i toggle player switching, anything works correctly. Both animation and moving
    I tried to create a third, simple player, with only one sprite without animation just to test moving, and is affected by the same issue. The hotspot collider won't let him pass. (Hotspot collider, not Guard's one)
    The question is: the asset i've sent you work on your side? because if it works, would be a mistery. I will try to install unity and copy these asset on another laptop, if this is the case

  • edited September 2023

    It shouldn't come to having to rely on a new Unity / laptop, but I do need to know as much detail as you can share.

    What messages are now appearing in the Console?

    The Guard's Hotspot collider in the package you sent me needed to be enabled, and reduced, for it to work.

    With the scene you sent, the Box Collider 2D spanned a large portion of the scene. While this won't affect collisions (so long as Is Trigger is checked) it will affect the ability to point-and-click. This is because clicks on a Hotspot collider will override clicks on the NavMesh if the two overlap.

    You're welcome to send me a new zip with your updates, but please enable components and settings such that the issue occurs without having to make any changes on my end (i.e. Player-switching enabled, colliders enabled, no local Player in the scene). That'll be necessary for us to both have a reliable comparison.

    If there are additional steps to go through after entering Play mode (e.g. switching Player mid-game), include them as well.

  • `Animator is not playing an AnimatorController
    UnityEngine.StackTraceUtility:ExtractStackTrace ()
    AC.AnimEngine_SpritesUnity:PlayCharAnim (string,int) (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:992)
    AC.AnimEngine_SpritesUnity:PlayStandardAnim (string,bool) (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:963)
    AC.AnimEngine_SpritesUnity:PlayIdle () (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:817)
    AC.Char:AnimUpdate () (at Assets/AdventureCreator/Scripts/Character/Char.cs:1088)
    AC.Char:BaseUpdate () (at Assets/AdventureCreator/Scripts/Character/Char.cs:671)
    AC.Player:_Update () (at Assets/AdventureCreator/Scripts/Character/Player.cs:191)
    AC.StateHandler:Update () (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:275)

    Cannot play animation idle_R (layer 0) on character grace's Animator, Grace

    -> AC debug logger
    UnityEngine.Debug:LogWarning (object,UnityEngine.Object)
    AC.ACDebug:LogWarning (object,UnityEngine.Object) (at Assets/AdventureCreator/Scripts/Static/ACDebug.cs:33)
    AC.AnimEngine_SpritesUnity:PlayCharAnim (string,int) (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:1015)
    AC.AnimEngine_SpritesUnity:PlayStandardAnim (string,bool) (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:963)
    AC.AnimEngine_SpritesUnity:PlayIdle () (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:817)
    AC.Char:AnimUpdate () (at Assets/AdventureCreator/Scripts/Character/Char.cs:1088)
    AC.Char:BaseUpdate () (at Assets/AdventureCreator/Scripts/Character/Char.cs:671)
    AC.Player:_Update () (at Assets/AdventureCreator/Scripts/Character/Player.cs:191)
    AC.StateHandler:Update () (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:275)

    Animator is not playing an AnimatorController
    UnityEngine.StackTraceUtility:ExtractStackTrace ()
    AC.AnimEngine_SpritesUnity:PlayCharAnim (string,int) (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:992)
    AC.AnimEngine_SpritesUnity:PlayStandardAnim (string,bool) (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:963)
    AC.AnimEngine_SpritesUnity:PlayIdle () (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:817)
    AC.Char:AnimUpdate () (at Assets/AdventureCreator/Scripts/Character/Char.cs:1088)
    AC.Char:BaseUpdate () (at Assets/AdventureCreator/Scripts/Character/Char.cs:671)
    AC.NPC:_Update () (at Assets/AdventureCreator/Scripts/Character/NPC.cs:117)
    AC.Player:_Update () (at Assets/AdventureCreator/Scripts/Character/Player.cs:133)
    AC.StateHandler:Update () (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:275)

    Cannot play animation idle_U (layer 0) on character grace (1)'s Animator, Grace

    -> AC debug logger
    UnityEngine.Debug:LogWarning (object,UnityEngine.Object)
    AC.ACDebug:LogWarning (object,UnityEngine.Object) (at Assets/AdventureCreator/Scripts/Static/ACDebug.cs:33)
    AC.AnimEngine_SpritesUnity:PlayCharAnim (string,int) (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:1015)
    AC.AnimEngine_SpritesUnity:PlayStandardAnim (string,bool) (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:963)
    AC.AnimEngine_SpritesUnity:PlayIdle () (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:817)
    AC.Char:AnimUpdate () (at Assets/AdventureCreator/Scripts/Character/Char.cs:1088)
    AC.Char:BaseUpdate () (at Assets/AdventureCreator/Scripts/Character/Char.cs:671)
    AC.NPC:_Update () (at Assets/AdventureCreator/Scripts/Character/NPC.cs:117)
    AC.Player:_Update () (at Assets/AdventureCreator/Scripts/Character/Player.cs:133)
    AC.StateHandler:Update () (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:275)

    Cannot play animation idle_U (layer 0) on character Wanda's Animator, p3idle

    -> AC debug logger
    UnityEngine.Debug:LogWarning (object,UnityEngine.Object)
    AC.ACDebug:LogWarning (object,UnityEngine.Object) (at Assets/AdventureCreator/Scripts/Static/ACDebug.cs:33)
    AC.AnimEngine_SpritesUnity:PlayCharAnim (string,int) (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:1015)
    AC.AnimEngine_SpritesUnity:PlayStandardAnim (string,bool) (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:963)
    AC.AnimEngine_SpritesUnity:PlayIdle () (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:817)
    AC.Char:AnimUpdate () (at Assets/AdventureCreator/Scripts/Character/Char.cs:1088)
    AC.Char:BaseUpdate () (at Assets/AdventureCreator/Scripts/Character/Char.cs:671)
    AC.NPC:_Update () (at Assets/AdventureCreator/Scripts/Character/NPC.cs:117)
    AC.StateHandler:Update () (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:275)

    Cannot play animation witchidle_U (layer 0) on character Witch Christina's Animator, p2idle_

    -> AC debug logger
    UnityEngine.Debug:LogWarning (object,UnityEngine.Object)
    AC.ACDebug:LogWarning (object,UnityEngine.Object) (at Assets/AdventureCreator/Scripts/Static/ACDebug.cs:33)
    AC.AnimEngine_SpritesUnity:PlayCharAnim (string,int) (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:1015)
    AC.AnimEngine_SpritesUnity:PlayStandardAnim (string,bool) (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:963)
    AC.AnimEngine_SpritesUnity:PlayIdle () (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:817)
    AC.Char:AnimUpdate () (at Assets/AdventureCreator/Scripts/Character/Char.cs:1088)
    AC.Char:BaseUpdate () (at Assets/AdventureCreator/Scripts/Character/Char.cs:671)
    AC.NPC:_Update () (at Assets/AdventureCreator/Scripts/Character/NPC.cs:117)
    AC.StateHandler:Update () (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:275)

    Animator is not playing an AnimatorController
    UnityEngine.StackTraceUtility:ExtractStackTrace ()
    AC.AnimEngine_SpritesUnity:PlayCharAnim (string,int) (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:992)
    AC.AnimEngine_SpritesUnity:PlayStandardAnim (string,bool) (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:963)
    AC.AnimEngine_SpritesUnity:PlayIdle () (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:817)
    AC.Char:AnimUpdate () (at Assets/AdventureCreator/Scripts/Character/Char.cs:1088)
    AC.Char:BaseUpdate () (at Assets/AdventureCreator/Scripts/Character/Char.cs:671)
    AC.Player:_Update () (at Assets/AdventureCreator/Scripts/Character/Player.cs:191)
    AC.StateHandler:Update () (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:275)

    Cannot play animation idle_R (layer 0) on character grace's Animator, Grace

    -> AC debug logger
    UnityEngine.Debug:LogWarning (object,UnityEngine.Object)
    AC.ACDebug:LogWarning (object,UnityEngine.Object) (at Assets/AdventureCreator/Scripts/Static/ACDebug.cs:33)
    AC.AnimEngine_SpritesUnity:PlayCharAnim (string,int) (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:1015)
    AC.AnimEngine_SpritesUnity:PlayStandardAnim (string,bool) (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:963)
    AC.AnimEngine_SpritesUnity:PlayIdle () (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:817)
    AC.Char:AnimUpdate () (at Assets/AdventureCreator/Scripts/Character/Char.cs:1088)
    AC.Char:BaseUpdate () (at Assets/AdventureCreator/Scripts/Character/Char.cs:671)
    AC.Player:_Update () (at Assets/AdventureCreator/Scripts/Character/Player.cs:191)
    AC.StateHandler:Update () (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:275)

    `

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.