Hello everyone.
I have been evaluating AC for the last couple of days and I have to say I’m very satisfied with its capabilities and extensibility.
I’ve got some newbie questions for you.
We have multiple player characters in our game so I’m trying to create a character switcher interface. I want to do it exactly as the manual explains and have NPCs for the inactive players and when I click on the switch interface transfer control to that character.
My problem is the case when the character I want to switch to is in another scene. The “Appear in Other Scene” option for the new player just displays the character at the player start point, and it seems that after the scene is changed the action list stops so I cannot handle it further.
I think it will require some custom code but I thought I should ask first
What would you think would be the best way to do it?
I have thought to have all the game rooms in one big scene so I can switch normally and then change the camera to the current player. I don’t really want to go this way because it will probably hinder performance and also it will not allow for different people to work on different scenes.
Another option would be to:
1. Save current player’s coordinates
2. Teleport player away
3. Bring the current players npc to the saved position
4. Switch player to the new character (use “in other scene”)
5. have some code that runs on scene change where if both the player and his npc are on the same scene the npc goes away and the player moves in his position.
Do you think that would do it? Would it appear seamless?
Another (unrelated) problem that I have is this:
When I use the Object->Add action in an ActionList asset, if I choose an object that is not on the current scene and leave the inspector on the action list as I run the game, it only works for that run. After that, the gameobject to instantiate parameter is removed from the action and is replaced with (None). If I have the actionlist editor and inspector closed then there is no problem. Could this be a bug? I'm running the latest versions of both Unity and AC.
Thank you in advance
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Player switching
First of all, keep your scenes separate. AC should allow you to work in different scenes - if it doesn't, that's a bug and will be fixed.
Generally, you should check the "Restore position" checkbox when using the Player: Switch Action. AC will store the current player's position (including scene), and load the new player's position (including scene). If it's the first time this new player has been called, no data will exist - so you can use the If first time in game settings to set initial values.
When you choose Appear in other scene, that will be the end of the ActionList (if the scene is indeed different to the current). However, you can use the Player: Check Action in the new scene's Cutscene On Start to determine the current player, and place accordingly. (You may need to have a Boolean check here to only perform this once)
Object: Add Action
Have you placed a ConstantID script on the referred GameObject? When dealing with assets, you generally need this script - it's used to store a unique reference that works between scenes.
As for the Add Action, a couple more things to check:
1) That the object you're referencing is a prefab, not a scene object
2) That the Constant ID script Inspector has "Retain in prefab" checked.