I'm trying to set up an Invector character to start a conversation when he looks at an NPC. I've followed the quick start tutorial on how to do this. The only difference is that I would like to use Center of Screen instead of Mouse Position because my cursor is not visible during game play. When I walk up to the NPC nothing happens. I also get the recurring error "Input button FIre2" is not set up".
Re: Selector is not working
Posted: Wed Oct 09, 2019 9:48 am
by Tony Li
That recurring error is going to prevent the Selector from working. You can resolve it by selecting menu item Edit > Project Settings, and then define "Fire2" in the Input section.
However, since you're using Invector I recommend using Invector's interaction system. This will give your players a consistent user experience. You can still set up a Dialogue System Trigger set to OnUse, and configure Invector to call its OnUse method.
Re: Selector is not working
Posted: Sun Jul 19, 2020 5:46 pm
by CodersExpo
I have a similar issue after following the video
I have a 2D game. I set the conversant Dialogue to trigger 'On Use', added the Usable component. Then selected the player actor and added the 'selector' component. The select at = Mouse Position, Layer Mask = Player, Run Raycasts = In 2D
When I play the scene and hover my mouse nothing happens. I click my left, right , middle and space bar...still nothing happens.
The first part of that video worked fine. Not the last part when trying to trigger off a mouse position. What am I missing??
Thanks!
Chuck
Re: Selector is not working
Posted: Sun Jul 19, 2020 8:05 pm
by Tony Li
Hi Chuck,
Some things to check:
Select menu item Tools > Pixel Crushers > Dialogue System > Welcome Window. Make sure Enable 2D Physics is ticked.
Make sure no UI canvases are blocking the mouse cursor. It's possible that a transparent UI image is on the screen. That will prevent the Selector from raycasting into the scene.
Select menu item Edit > Project Settings. In the Physics2D section, make sure Queries Start In Colliders is ticked.
Re: Selector is not working
Posted: Mon Jul 20, 2020 1:17 pm
by CodersExpo
I did as you suggested, the first did need to be checked, so I did that. I disabled any UI stuff completely. The third step was already enabled/checked. I tried again to no avail
I'm using Unity 2019.4.1f1 Personal. 2D mode Y up X right. Followed the video again...the only change I made different was to change the Selector component to Run Raycast = 2D. So I even changed it back to 3D and still nothing happens on hover or hitting the space bar.
I'll maybe try a blank project but this one is just started itself with one scene and very little content already.
Thanks for your time!
Re: Selector is not working
Posted: Mon Jul 20, 2020 1:35 pm
by Tony Li
Please check these items on the thing you're trying to target with the mouse:
Its GameObject layer is set to Player (since you set the Selector to raycast for the Player layer).
It has a Usable component.
It has a 2D physics collider such as BoxCollider2D.
If that doesn't help, would it be possible for you to send a reproduction project to tony (at) pixelcrushers.com?
Re: Selector is not working
Posted: Mon Jul 20, 2020 2:30 pm
by CodersExpo
Wow, first I have to say I'm sorry to have wasted your time, but I was able to figure it out.
The problem was, I'm using a 2D sprite (not a 3d cube like the tutorial video) and I missed the fact that my sprite did NOT have a 2d collider on it. By default a new 3d game object does...but a new sprite does not.
Finally, I want to add, that with all the assets I use, I have rarely had the immediate response you provided AND the willingness to look at the project itself to identify the issue. Talk about top notch support!
Thank you very much!
Looking forward to learning all I can about this asset.
Chuck
aka CodersExpo
Re: Selector is not working
Posted: Mon Jul 20, 2020 2:33 pm
by Tony Li
Thanks, Chuck! Glad to help!
Re: Selector is not working
Posted: Wed Feb 03, 2021 6:07 am
by CalamaBanana
I do have the issues with the 2D selector as well. I have it working fine in an old project, but even comparing them I can't figure out where I am wrong in the new one.
I have 2D Rigidbodies and 2D capsule colliders on both Player and NPC, bumping into the NPC applies physics correctly. Just the selector can't seem to hit the NPC.
Tony Li wrote: ↑Sun Jul 19, 2020 8:05 pm
Select menu item Tools > Pixel Crushers > Dialogue System > Welcome Window. Make sure Enable 2D Physics is ticked.
The issue might be at that step, I can not find "Enable 2D Physics". But on the other hand, I can't find it in my old project either.
This is how the Welcome Window looks for me:
Re: Selector is not working
Posted: Wed Feb 03, 2021 9:10 am
by Tony Li
Hi,
If you're using a more recent version of the Dialogue System, select menu item Tools > Pixel Crushers > Dialogue System > Welcome Window. Then tick the USE_PHYSICS2D checkbox.
If your project doesn't compile, you can still add USE_PHYSICS2D by selecting menu item Edit > Project Settings. In Player > Other Settings > Scripting Define Symbols, add USE_PHYSICS2D, using a semicolon ( ; ) to separate it from any other content in the field.
Also check the Selector. Make sure the Layer Mask will pick up your Usables' layers, Max Selection Distance is far enough (true 9999), and Run Raycasts is set to In 2D.