Forum rules - please read before posting.

Player Switch Issue?

Hello, I've finished the light on/off mechanic but I'm having an issue when switching players. The first time I switch the character, the transition works as intended, when I attempt to switch back, it appears to blink mid transition with another frame. Not sure if it's somethting I set up incorrectly on the character or if it's a general settings issue, or if it's an issue. <- Video <- Actionlist Set up


  • Could you share screens/details of your Player Inspectors and the way they are animated?

    As a test, what is the result of opening AC's ActionPlayerSwitch script and adding the following to the end of its OnSpawnNewPlayer function (around line 294)?

    newPlayer.GetAnimator ().Update (0.2f);
  • edited May 12

    @ChrisIceBox What exactly from animations would you like me to post? I've added inspectors screen shots. I added that line but nothings seems to happen.

                                OnSpawnPlayer (newPlayer);
                                return 0f;

    What's weird about this is that the first time I do a player switch, there's no issue, only when I attempt to switch back and then do it again, this occurs. If you look at the video, it switches okay first time around, the moment I switch again, that blinking appears (it seems to be the frame from idle front/back, it's too quick, I can't tell which). <inspector

  • Is the blinking occuring at the moment the switch occurs, or does the switch occur the moment the lights turn off (while the character is still animating)?

    Try enforcing the player to face left with a Character: Face direction Action, snapping instantly leftward, before the Actions.

  • edited May 13

    The blinking seems to take place right after the switch on/on animation for the character plays. At the end of the flow, right as it's suppose to switch the character from "Dark" to "Normal". I added Face Direction, but it still does the same thing.

    As far as I can tell it's spawning the character in the standard idle front position for 1 frame before forcing the "Replace Old Position". I could try removing the direction suffix check and adding the direction directly in the clip name, maybe that will help. - This did not help, just tried it.

  • As far as I can tell it's spawning the character in the standard idle front position for 1 frame before forcing the "Replace Old Position"

    I'm of the same opinion - though I'm having trouble recreating this on my end.

    Does it occur if you temporarily skip the custom animation beforehand?

  • edited May 13

    It doesn't occur if I remove the Animation, It switches the character without any blinking. Is it an issue with how I have my animation set-up in the action list (perhaps the timing) or is it a bug? <- this is my action list.

    What's wierd is, the first time I activate "off" everything works perfectly. The moment I click again and activate "On" it occurs, but then also affects "off" as well.

  • The issue is to do with the restoration of the Player's save data. When you switch for the first time, there is no data to load - and so it won't need to apply any further changes after the switch.

    Try inserting an Engine: Wait Action in between the Character: Animate and Player: Switch Action.

    Give this Action a wait time of -1. A negative value will cause it to wait for a single frame - does the correct it.

  • Hi there. Sorry to be the bearer of bad news, but it still isn't working - it's acting exactly the same. I've added it to both "on" and "off". I've attached an image.

  • Thanks. I have, at last, managed to recreate the issue. Thank you for your patience - I should be able to look into a proper fix now.

  • Open up AC's Player script, and look for the following around line 1105:

    _spriteDirectionData.LoadData (playerData.spriteDirectionData);

    Immediately underneath, copy/paste:

    _Update ();

    Does that resolve it?

  • Don't worry about it. I'm glad that this could be reproduced and eventually fixed. Let me check the fix you suggested.

  • That fixed it! Thank you so much for your help and patience.

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.