Help: Issue with 2d proximity.

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
jnhasty7
Posts: 16
Joined: Sun Apr 28, 2019 8:21 pm

Help: Issue with 2d proximity.

Post by jnhasty7 »

Hello, I'm having trouble with my proximity distance between my 2d player and NPC. You can see from at the top of the game screen that once I get in range of being able to start the interaction, it's flickering on/off. I do have a capsule collider 2d on both NPC and player, and I also use hitbox studio pro that creates hitboxes on the fly per animation, but these are not capsule colliders, just normal rectangles set to isTrigger = true.

User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Help: Issue with 2d proximity.

Post by Tony Li »

Hi,

It's probably Hitbox Studio. Triggers can still register OnTriggerEnter2D events with other triggers. Can you move the Proximity Selector-related triggers to child GameObjects that are on their own layer? This way you can more precisely control OnTriggerEnter2D events.
jnhasty7
Posts: 16
Joined: Sun Apr 28, 2019 8:21 pm

Re: Help: Issue with 2d proximity.

Post by jnhasty7 »

worked like a charm Tony, thank you.

While you're here, I'm also having trouble with different NPC subtitle panels.
-I've copied over the NPC Subtitle Panel as a child under my NPC Game Object.
-I've added the NPC Subtitle Panel to the Stand Dialog UI Script (under subtitle panels).
-I've edited the new NPC Subtitle Panel to play sound for the typewriter.
-I've added a "Dialogue Actor" script and set the "Actor" to the Dialog Database that I'm using.
-Below that, I've set the NPC object.
-It actually works as a new Panel. It plays the sounds with the typewriter, but the portrait, NPC name, and subtitles (text) are not displaying as they were by using the default, it's just showing the (NPC Name) | (NPC Subtitle).
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Help: Issue with 2d proximity.

Post by Tony Li »

Hi,

Since the new subtitle panel is no longer a child of the Standard Dialogue UI GameObject, it might be better to not assign it to the Standard Dialogue UI's subtitle panels list. This is because it could get disconnected if you change to a scene that doesn't contain the NPC. Instead, set the NPC's Dialogue Actor > Dialogue UI Settings > Subtitle Panel Number dropdown to Custom, and assign the new subtitle panel to the Custom Subtitle Panel field.

Then make sure that the fields are assigned correctly on the new subtitle panel's Standard UI Subtitle Panel component.
jnhasty7
Posts: 16
Joined: Sun Apr 28, 2019 8:21 pm

Re: Help: Issue with 2d proximity.

Post by jnhasty7 »

I've done what you said and taken it off the Basic Stand UI list, and I set it up as said above. It's still behaving the same way.
This is my object hierarchy
Image
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Help: Issue with 2d proximity.

Post by Tony Li »

Are the correct elements assigned to the NPC's Standard UI Subtitle Panel component?

Also, is it a child of a canvas? Unity UI elements need to be inside a canvas.

As a test, you can add an instance of the Bubble Subtitle Panel prefab to the NPC. This prefab has its own canvas. Set its canvas's layer so it's on top of your sprites to make it visible, and assign it to the Custom Subtitle Panel field. If it works, then look at your NPC's NPC Subtitle Panel.

Is it possible that one of the Dialogue Manager's Basic Standard Dialogue UI subtitle panels is still visible and overlapping the NPC's subtitle panel?

I'm finishing work for the evening, but I'll check back first thing in the morning.
jnhasty7
Posts: 16
Joined: Sun Apr 28, 2019 8:21 pm

Re: Help: Issue with 2d proximity.

Post by jnhasty7 »

I took your advice and played around with it.

I created a canvas object and put the "NPC Subtitle Panel" as its child.
Then I changed Standard UI Subtitle Panel (Script) > Visibility > Start State = Closed.

Then it started behaving like I wanted it.

Thanks for the help and great product!
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Help: Issue with 2d proximity.

Post by Tony Li »

Happy to help, and glad it's working now!
Post Reply