Hi guys,
First off - great work on Dialogue System. I love it and it works really great for me. That being said, I'm having a problem that is potentially game-breaking going forward and so I need to know the best way to deal with it. However, I do feel I know the source of the problem so this may help.
So basically, I am working on an adventure-RPG game, similar to Zelda. The entire system is working great - I can enter dialogue with NPCs, trigger conversations quite easily and so on. That is, until the player character changes scenes through way of a scene-change portal.
After changing scenes by walking into the scene-change portal, the current player game object is now an instance of the game object, and so when I have conversations with NPCs, it isn't disabling player movement like it does just fine before you change scenes. I am sure this is something to do with the reference to the game object - in the 'Actor' field, the player prefab is selected. However, in the previous scene, the 'Player' game object is already pre-spawned in the scene. It is not spawned by way of any script. I believe this may be part of the problem. So my question is, basically, should I change the character object in the first scene (that an instance of is carried over into the second scene with inventory etc.) to be spawned from the same prefab I'm selecting as the 'Actor' in the dialgoue in question in the second scene? Will this fix the issue because the dialogue element will recognize that the instance of the player prefab is the same player object referenced as the 'Actor'? If I play the scene on its own without entering it from another scene, and with the player prefab already placed into the scene, the dialogue system functions correctly and will stop my player movement during dialogue. So the issue appears to be with loading the scene within play mode from another scene, as the player game object is NOT an instance in this case.
Apologies for the long winded explanation, just wanted to try be as specific as possible. Any help would be greatly appreciated, as I simply can't continue making dialogue events in my game without fixing this.
Cheers!
Conversations break after changing scenes
Re: Conversations break after changing scenes
Hi,
Add a Dialogue Actor component to your player GameObject and set its Actor dropdown to the Player actor. This will associate the player GameObject with the Player actor.
Then leave your Dialogue System Trigger's Start Conversation > Conversation Actor field unassigned. If the field is unassigned, it will use the GameObject associated with the Player actor. (This assumes your conversation's actor is the player.)
To disable player movement, add a Dialogue System Events component to the player GameObject. Since the Dialogue System Trigger will use the player GameObject, the Dialogue System Events component will receive OnConversationStart/End events. Configure those events to disable and re-enable player movement.
Add a Dialogue Actor component to your player GameObject and set its Actor dropdown to the Player actor. This will associate the player GameObject with the Player actor.
Then leave your Dialogue System Trigger's Start Conversation > Conversation Actor field unassigned. If the field is unassigned, it will use the GameObject associated with the Player actor. (This assumes your conversation's actor is the player.)
To disable player movement, add a Dialogue System Events component to the player GameObject. Since the Dialogue System Trigger will use the player GameObject, the Dialogue System Events component will receive OnConversationStart/End events. Configure those events to disable and re-enable player movement.
Re: Conversations break after changing scenes
Hey Tony,
Apologies for the late reply, had a whole bunch of stuff going on this past week.
That solution seems like a winner, I'm going to try it out today. Pretty confident this should be the fix so thanks very much, if I have any problems with it I'll drop back in cheers!
Apologies for the late reply, had a whole bunch of stuff going on this past week.
That solution seems like a winner, I'm going to try it out today. Pretty confident this should be the fix so thanks very much, if I have any problems with it I'll drop back in cheers!
Re: Conversations break after changing scenes
Hey Tony,
I've tried what you suggested to associate my player prefab with the player actor - added a Dialogue Actor component to the player prefab, set its' actor to the 'Player' actor, then left the 'Actor' section of the NPC in question's dialogue trigger blank. Unfortunately there appears to be no change, and when I trigger the conversation my player is still able to move. It's worth mentioning I'm using Invector's Third Person Controller, but I have the integration package and it has been working absolutely fine until I load another scene within the game. Any idea why it still isn't disabling player movement input on this conversation?
Thanks again for your help
I've tried what you suggested to associate my player prefab with the player actor - added a Dialogue Actor component to the player prefab, set its' actor to the 'Player' actor, then left the 'Actor' section of the NPC in question's dialogue trigger blank. Unfortunately there appears to be no change, and when I trigger the conversation my player is still able to move. It's worth mentioning I'm using Invector's Third Person Controller, but I have the integration package and it has been working absolutely fine until I load another scene within the game. Any idea why it still isn't disabling player movement input on this conversation?
Thanks again for your help
Re: Conversations break after changing scenes
Hi,
Does the player GameObject in the other scene have a Dialogue System Invector Bridge component? Make sure the player GameObject in every scene has this component.
Does the player GameObject in the other scene have a Dialogue System Invector Bridge component? Make sure the player GameObject in every scene has this component.
Re: Conversations break after changing scenes
Yep, and I made sure it kept this component after changing scenes.
Re: Conversations break after changing scenes
Would it be possible for you to send a reproduction project to tony (at) pixelcrushers.com?