Forum rules - please read before posting.

Player switch

Hello,
Hope you all are doing well. I have been trying to figure out a solution to my player switch problem. The link below has the photo that show what I am working on.

I show the onstart chain, OnLoad, inspector tab, and player settings.

Basically, the onstart chain on part six halts to play as intended. The cutscene, “Cutscene lisa returns to hospital for check up” plays correctly when I play it independently on the action list OnStart, yet in the chain it does not play as intended. I show this on the photo called: “Cutscene plays right independently”
The player should switch to “Lisa” facing right yet she faces down and does not switch from “Lisanosockhaird”.

I added an actionlist starter to the cutscene where I want the player to be switched and tried to place the cutscene on on load but have not found the solution.

Is there anything you can recommend that I do?

https://imgur.com/a/PftJrDO

Respectfully,
-Asuna

Comments

  • I'm afraid I'm a bit lost in trying to go through these. What is the significance of "Cutscene lisa returns to hospital for check up" if the Player-switch occurs at the end of OnStart? Does the former need to run before or after the latter?

    The logic looks like it can be simplified. Right now it looks like you're running it (Action 1) and then immediately cancelling it under some conditon (6). If so, it's better to avoid running it at all if the condition is not correct.

    Try moving Actions 14 and 15 to a separate Cutscene that you can then call from within OnStart. Avoid running OnStart for the moment, and then run both this new Cutscene and "lisa returns" manually from the Inspector. Which order is needed for them to run correctly?

  • Hi,

    Yes I apologize for the mixup. The cutscene "Cutscene lisa returns to hospital for check up" needs to be ran after Action (4) Variable: Check if condition is met. Which even if I connect immediately after Action 4 with an Action list Run does not run the way I'd like to.

    The Action (14) Player: Teleport inactive, (15) Player switch, and (16) Character Animate were just there for testing purposes to see if the player switch would work that way but it doesn't.

    Within the cutscene: "Cutscene lisa returns to hospital for check up" I have the player switch option to Lisa and tried the replace old players position and the latter but nothing gives the desired position for her (Lisa). I also have the Player: Teleport inactive Lisa move to current scene but nothing.

    I have lisa’s prefab in the hierarchy alongside lisa's other prefabs in the scene. Don’t know if this is correct and the way to do things?

  • If you're using AC's Player-switching feature, you'll need to keep your Player prefabs out of scene hierarchies, and let AC spawn them automatically as needed.

  • Okay, so far the character lisa does spawn when I have the prefab in the hierarchy and play the scene independently but when I connect it to the chain she disappears.

    I see something on the player settings under characters called "Reference Player prefabs with addressables?" but it i can only use this option if I import it from the package manager. Do u recommend I download this?

    I am using AC's Player-Switching feature.

  • Okay, so far the character lisa does spawn when I have the prefab in the hierarchy and play the scene independently but when I connect it to the chain she disappears.

    Don't have your prefabs in the hierarchy, let AC handle character spawning and placement.

    I see something on the player settings under characters called "Reference Player prefabs with addressables?" but it i can only use this option if I import it from the package manager. Do u recommend I download this?

    One thing at a time, I'd say. It's not necessary for the Player-switching feature to work.

  • Goodmorning Chris,

    I went ahead and removed the prefabs from the hierarchy. I am also sending you another link to show you the updated status on all the cutscenes.
    The issues still remains that the player character switch from lisanosockhaird from the cutscene “Cutscene lisanosockhaird is sleeping on bed” remains when I try to play the cutscene “Cutscene lisa returns to hospital for check up” from my onstart cutscene.

    I have the animation on the cutscene “Cutscene lisanosockhaird is sleeping on bed” called “Lisalayingeyesclosed” that I return back to idle at the end of that same cutscene but I believe it doesn’t go back to idle. I don’t have set to loop pose but when I play the wanted scene with the issue “Cutscene lisa returns to hospital for check up” the animation plays instead of lisa.

    https://imgur.com/a/nJ8PH4F

  • Your long cutscene names means I can't be sure what's being referenced in your Actions, but it looks like you're still running an ActionList and them immediately killing it.

    You're also using running multiple ActionLists "on start" via the ActionList Starter component. The order in which these components run cannot be set - so you should avoid this if there is an interdependence between them.

    It also looks like "Cutscene lisa returns to hospital for check up" is also being run via the Scene Manager - so it'll be called twice as it's also using ActionList Starter.

    With different cutscenes needing to run as part of your startup logic, with a set order, it's best to create a single entry point and then run all from there as needed. Avoid running and then killing an ActionList - only run it in the first place if it should run in full. If it needs to run to completion before anything else runs, check Wait until finish? in the ActionList: Run Action.

    Your Action chains are very long at the moment, so it's going to be difficult to debug. I'd recommend creating a duplicate test scene in which each cutscene only makes the minimal changes (i.e. Switches or Teleports a Player), along with ActionList: Comment Actions so that logs can appear in the Console.

  • Oh ok yeah cause on the console is says "Error reason is 'No subscription' and no additional error was provided.... I sent a link w the photo. Is there coding I can use to try and debug this with? Or is testing in a duplicate scene the only way?

    https://imgur.com/a/XnOgewJ

  • https://imgur.com/a/y94BmwP

    When I press play it also says I cannot player switch cause desired character is already set. I have the player 'Lisanosockshaird' to spawn in this scene in my player settings (I did this through the cog wheel) but want the player Lisa to then spawn.

  • on the console is says "Error reason is 'No subscription' and no additional error was provided..

    This is coming from Unity itself and is not AC related. You can click the Collapse button to merge them all into one.

    When I press play it also says I cannot player switch cause desired character is already set. I have the player 'Lisanosockshaird' to spawn in this scene in my player settings (I did this through the cog wheel) but want the player Lisa to then spawn.

    Which Player is marked as your default? If you cannot switch because you're already controlling the selected character, that character will already be in the scene.

    If you want Lisa to spawn later, you'll need to start in control of a different Default Player.

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.