How do I get OnUse to work?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
vponsaing
Posts: 2
Joined: Thu Sep 22, 2022 5:50 am

How do I get OnUse to work?

Post by vponsaing »

Hi, could someone please assist?

I have been trying to get the On Use option to start a conversation. It's a basic principle before I can actually do anything with this package but I can't. I've tried following the tutorials both written and the videos but according to those, there shouldn't be an issue.

Reproduction using the wizards:
  • Brand new empty 2D project. Import Dialogue System - all options. Use Wizard. Put in Dialogue Manager, add instance of Focus Template. Tick Use system language. Tick Use save system. Inspect and finish.
    Change IDM from Joystick to keyboard. Enable 2D support.
    Create 2d square game object and change colour to red. Use NPC wizard and add object to it. Use dialogue actor private hart. Scene is in 2D. Tick dialogue system trigger, on use, demo database, tick dialogue system events.
    Create 2d circle and name player. Use player wizard and add. Center of screen. Record position of player.
    NPC settings- action, start conversation, Private Hart.
    Position game objects - NPC to centre of screen, player just off centre but overlapping.
    Press play, try to use fire buttons. Conversation doesn't start. (Is the Issue.)
Changing the trigger to OnStart works but is not what I need.

I would appreciate your help. Thank you!
Attachments
Unity_WsVJACx1BG.png
Unity_WsVJACx1BG.png (113.81 KiB) Viewed 387 times
Unity_oJ0Rzs7k78.png
Unity_oJ0Rzs7k78.png (105.65 KiB) Viewed 387 times
Unity_eK3AYNiZB9.png
Unity_eK3AYNiZB9.png (89.76 KiB) Viewed 387 times
User avatar
Tony Li
Posts: 21972
Joined: Thu Jul 18, 2013 1:27 pm

Re: How do I get OnUse to work?

Post by Tony Li »

Hi,

Inspect the Selector component. Change "Run Raycasts" from "In 3D" to "In 2D".
vponsaing
Posts: 2
Joined: Thu Sep 22, 2022 5:50 am

Re: How do I get OnUse to work?

Post by vponsaing »

Hi,

Thanks for your response.
Changing Raycast to 2D was something I missed on the empty project. Also needed to re-added the rigidbody2D and collider2D because I deleted them in the last attempt. I have the empty project working at least.


Thanks again
User avatar
Tony Li
Posts: 21972
Joined: Thu Jul 18, 2013 1:27 pm

Re: How do I get OnUse to work?

Post by Tony Li »

Glad to help! If you have any other questions about using the Selector or anything else, just let me know.

Tip: When you added the Selector, it also added a Selector Use Standard UI Elements component. This component will make the selector show whatever "Standard UI Selector Elements" is in the scene. By default, the Dialogue Manager GameObject's Instantiate Prefabs component's Prefabs list points to a prefab named Basic Standard UI Selector Elements. If you want to customize the appearance of the UI when you select a Usable, you can assign a different prefab to the Prefabs list. For example, you can duplicate Basic Standard UI Selector Elements, customize the appearance of the duplicate, and assign the duplicate to the Prefabs list in place of the original.
Post Reply