Duplicate Player on Load (Corgi Engine)

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
GreenConure
Posts: 26
Joined: Sun Oct 24, 2021 10:32 am

Duplicate Player on Load (Corgi Engine)

Post by GreenConure »

Hello!

Thank you so much for your wonderful asset! I've been learning how to use the dialogue system with Corgi Engine.
I'm mostly getting everything to work but there's one thing that I haven't been able to do correctly and I'm unsure if it's coming from Dialogue System or if it's from Corgi.

In my scene I have Player and NPC. Every level is set up that it reloads every time NPC dies and I'm doing this using a Dialogue System Trigger whenever NPC hits the collider it triggers a game over scene and player is loaded back to their initial spawn point. I've managed to also get the NPC to reload to their initial spawn point as well. The problem I'm running into is these:

1. Whenever the scene reloads, multiple instances of my Player is reloaded with each Game Over conversation, with sometimes the duplicate Player spawning in different locations in the scene (varies from Player spawning near the initial spawn location, sometimes where the Game Over conversation is triggered).
2. (Sometimes) The NPC that spawns can't move left or right (they can jump though) but can be interacted with.
3. In some occasions, the Player and NPC spawns correctly but their movement speed is super slowed down for some reason and sometimes the Player floats into the ceiling.
4. Sometimes whenever a conversation ends, the Player freezes and cannot move. (Disallow movement, can only activate if grounded, prevent jumps are all unticked)

I've tried multiple ways of reloading the scene such as using the Load Level command with the spawnpoint location or loading the scene from Save Helper via Restart Level. I've tried using the spawnpoint game object or using the Level Start (Checkpoint) component that comes with Corgi Engine. The Player and NPC have Position Savers component. I'm using this with the Menu Framework as well. I'm not getting any other console problems other than this:

NullReferenceException: Object reference not set to an instance of an object
PixelCrushers.DialogueSystem.CorgiEngineSupport.ConversationZone.DisallowMovement () (at Assets/Pixel Crushers/Dialogue System/Third Party Support/Corgi Support/Scripts/ConversationZone.cs:250)

I apologize in advance if this is a simple problem! I would really appreciate any pointers in the right direction. Thank you so much for your time!
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: Duplicate Player on Load (Corgi Engine)

Post by Tony Li »

Hi,

Is your player GameObject configured to survive across scene changes? If so, please turn this feature off. Whenever you load a scene, you'll get a fresh new instance of the player. Same for the NPC.

Does your player GameObject have a Character Button Activation component? This component allows Corgi characters to interact with things such as Conversation Zones.
GreenConure
Posts: 26
Joined: Sun Oct 24, 2021 10:32 am

Re: Duplicate Player on Load (Corgi Engine)

Post by GreenConure »

Hello!

The characters are set to instantiate a new one with every scene load and they have a destroy upon death component as well. Only the Player has the Character Button Activation component.

What's happening right now in the scene is that whenever the NPC triggers the death conversation, NPC and player respawns into position but the Player from the previous scene is still in the last position and more are spawned with every death trigger.

Is there any other info/screenshots you'd like me to provide to help you? Let me know!
Thank you so much!
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: Duplicate Player on Load (Corgi Engine)

Post by Tony Li »

Hi,

This updated integration package should get rid of that error:

DS_CorgiSupport_2021-10-25.unitypackage

Are you using the Character Persistence ability? If so, make sure your Level Manager is configured to instantiate a player prefab into the scene. Don't put a player in the scene at design time.

If that doesn't help, feel free to send a reproduction project to tony (at) pixelcrushers.com.
GreenConure
Posts: 26
Joined: Sun Oct 24, 2021 10:32 am

Re: Duplicate Player on Load (Corgi Engine)

Post by GreenConure »

Hello!

Thank you so much! Edit: Removing the Character Persistence component helped fix the problem!

Really appreciate all your support!
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: Duplicate Player on Load (Corgi Engine)

Post by Tony Li »

Hi,

Thanks for sending the reproduction project. I replied with an updated Corgi integration package, which will also be in the next regular release of the Dialogue System. After importing the package, add a DialogueSystemCorgiEventListener component to your Dialogue Manager GameObject.
Post Reply