Can't interact unless on default layer

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Kadum1013
Posts: 9
Joined: Fri Mar 15, 2024 9:10 pm

Can't interact unless on default layer

Post by Kadum1013 »

Hello all, I just started using Dialogue System For Unity today. Watch all the tutorials and everything works but when I tired adding it to my already made NPC, hooked everything up. The interact text isnt showing up, I figured out if the NPC layer is set to default then it works. On the player in the Selector script, I tired setting it to just to the Character layer. When the NPC is set to default and the Layer Mask on the selector is set to Character only, when i pass the mouse over the NPC it quickly shows the interact text and goes away. it happens really fast.

I am not sure what I am doing wrong, I would like to use the Character Layer mask so i can just plug the Dialogue system.

Thank you for taking the time to read this, any help would be very welcoming!
I can get pictures and such of the setup if need be.

Thank you.
User avatar
Tony Li
Posts: 21049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Can't interact unless on default layer

Post by Tony Li »

Hi,

Thanks for using the Dialogue System!

Please see: How To: Fix Selector and Proximity Selector Issues

It should work fine if your NPC is on the Character layer and your Selector's Layer Mask includes the Character layer.

If it's not working, make sure another collider on a different layer isn't blocking the Selector's raycast. Tick the Selector's Debug checkbox. If you're running raycasts in 3D and you tick the Selector's Debug checkbox, it will show what 3D objects it's detected:

Image

In the Scene view (on the left), the yellow line is the raycast from the camera. It detected the NPC, Private Hart, so it drew a green sphere at the detection point. If it were blocked by a non-Usable GameObject, it would show a red sphere at the hit point.
Kadum1013
Posts: 9
Joined: Fri Mar 15, 2024 9:10 pm

Re: Can't interact unless on default layer

Post by Kadum1013 »

Ahh I see, the debug helped. The problem I seem to be having is my game is in 3D, in 3rd person view over the Player. The ray it shoot is coming from the camera and hitting the player. Is there a way to change where the ray gets shot from
or will I have to just set it up to use the proximity selector?

Thank you for the quick reply!
User avatar
Tony Li
Posts: 21049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Can't interact unless on default layer

Post by Tony Li »

Hi,

Some ideas:
  • Put the player on a layer that's not in the Selector's Layer Mask. (DemoScene1's Player is on the Ignore Raycasts layer, for example.)
  • Make and use a subclass of the Selector class that overrides Run3DRaycast to run the raycast from some other point (e.g., a point a little bit ahead of the player's collider) instead of from the camera.
  • Or use a Proximity Selector.
  • Or your own selection/interaction system. Use of Selector/ProximitySelector is optional.
Kadum1013
Posts: 9
Joined: Fri Mar 15, 2024 9:10 pm

Re: Can't interact unless on default layer

Post by Kadum1013 »

I understand! Thank you for the tips!
Making sure I wasnt missing something that was staring me in the face lol.

Thank you again for the help!
User avatar
Tony Li
Posts: 21049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Can't interact unless on default layer

Post by Tony Li »

Glad to help!
Post Reply