Adding Custom Field and problems

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Esylin
Posts: 45
Joined: Thu Dec 16, 2021 1:21 am

Adding Custom Field and problems

Post by Esylin »

Hello,

I am trying to use the "Activate On Hover" .cs script to activate a game object. I can activate the text tooltip successfully but not the game object.

Readme file says
Add a custom field named 'Activate On Hover' with the name of a GameObject to activate when hovering over the response.


But I don't understand how it works after reading the manual here:
https://www.pixelcrushers.com/dialogue_ ... ditor.html

1. I tried to click on the "+" on the Templates page but it does not add any custom field.
2. I tried to edit CustomFieldType_TemplateType.cs but it does not work.

What's worse my project file seems to broke after I touched the .cs file. I am getting tons of error which says:

Assets\Plugins\Pixel Crushers\Dialogue System\Scripts\Editor\Fields\Base\CustomFieldType_Number.cs(8,18): error CS0534: 'CustomFieldType_Number' does not implement inherited abstract member 'CustomFieldType.Draw(string, DialogueDatabase)'

And the dialogue window is completely gone in my project but I can't reopen it again. :( Please help! :(
User avatar
Tony Li
Posts: 22131
Joined: Thu Jul 18, 2013 1:27 pm

Re: Adding Custom Field and problems

Post by Tony Li »

Hi,

If you can undo your changes -- for example, by reverting to a previous version in your version control system -- that's the easiest way to undo this. Then jump to step 4.

If you can't do that, then:

1. Undo any changes to any script files that you've made.

2. Restart Unity.

3. Try to open the Dialogue Editor window onto your dialogue database. If you can do this, go to the Templates tab. Expand the Dialogue Entries foldout. Locate any fields that you may have added. Click the "-" button to the right of the field. From the pop-up window, click Remove All.

If you can't open the dialogue database, the process is a little more complicated. If this is the case, let me know.

4. Then, still in the Templates tab, click the "+" to the right of the Dialogue Entries foldout. This will add an untitled Text field. Set its Title field to "Activate On Hover" (without quotes, using that exact spelling and capitalization). Then select Menu > Apply Template To Assets.

5. Add a Tooltip text component to your dialogue UI. Set its text to an empty string.

6. Add the ActivateOnResponseHover script to your response button(s). Assign the Tooltip text. Don't edit the script. You don't need to edit any scripts for this whole process.

6. In your dialogue entries, you can:
  • Set the Description field to use it as tooltip text.
  • Set the "Activate On Hover" field to the name of a GameObject to activate when hovering over the response. This GameObject's root parent must be active.
Esylin
Posts: 45
Joined: Thu Dec 16, 2021 1:21 am

Re: Adding Custom Field and problems

Post by Esylin »

Hi,

It looks like the project is broken....the dialogue database won't open, I can't re-import Dialogue System from the asset store.
Bug.png
Bug.png (24.22 KiB) Viewed 920 times
Anyways, I decided to lose a few days work and revert to a previous version :(

About Activate on Hover:
I managed to add the Custom Field and a Game Object named Window, but I can't activate it as I hover over the response. Am I setting it up correctly?
Screenshot1.png
Screenshot1.png (47.24 KiB) Viewed 920 times
Screenshot2.png
Screenshot2.png (182.15 KiB) Viewed 920 times
My Tooltip text works by the way, but not the Window Game object. My dialogue UI and Window Game object are active. What went wrong? :(
User avatar
Tony Li
Posts: 22131
Joined: Thu Jul 18, 2013 1:27 pm

Re: Adding Custom Field and problems

Post by Tony Li »

Hi,

It looks like you've set up everything correctly so far. Please import this patch:

PixelCrushers_GameObjectUtilityPatch_2023-05-04.unitypackage

It fixes a bug that didn't allow the ActivateOnResponseHover script to activate inactive GameObjects that are part of the Dialogue Manager's hierarchy.
Esylin
Posts: 45
Joined: Thu Dec 16, 2021 1:21 am

Re: Adding Custom Field and problems

Post by Esylin »

Hi, I have another question with "ActivateOnResponseHover.cs" :(

Right now my response button template has event trigger component and pointer enter/exit/click configured to control the game objects that activate and deactivate as the player select different choices with the mouse.

However, pointer enter/exit/click does not work with keyboard and controller.

I tried to use Select/Deselect/Submit event triggers for keyboard input but it caused a bug that the activated game object sometimes doesn't deactivate after I select the choice.

How do I solve this? Am I doing this incorrectly? :(
User avatar
Tony Li
Posts: 22131
Joined: Thu Jul 18, 2013 1:27 pm

Re: Adding Custom Field and problems

Post by Tony Li »

Hi,

Which GameObject is the "activated game object" that you're referring to? If it's the response button itself, you could assign two events to the Button component's OnClick():

1. StandardUIResponseButton.OnClick
2. GameObject.SetActive (checkbox unticked)

This will tell the Dialogue System that you clicked the button, and then it will deactivate the button.
Esylin
Posts: 45
Joined: Thu Dec 16, 2021 1:21 am

Re: Adding Custom Field and problems

Post by Esylin »

Tony Li wrote: Wed Jun 07, 2023 3:23 pm Hi,

Which GameObject is the "activated game object" that you're referring to? If it's the response button itself, you could assign two events to the Button component's OnClick():

1. StandardUIResponseButton.OnClick
2. GameObject.SetActive (checkbox unticked)
Hi, the activated game object is a different game object outside of dialogue UI prefab. So GameObject.SetActive does not work. :(

After a bit more testing it seems that this bug is more likely to occur if the response choice selected does not have any follow up dialogue text. Adding dialogue text after the response choice reduces the chance of this bug from happening but it does not remove the bug completely.
User avatar
Tony Li
Posts: 22131
Joined: Thu Jul 18, 2013 1:27 pm

Re: Adding Custom Field and problems

Post by Tony Li »

Would it be possible for you to send a reproduction project to tony (at) pixelcrushers.com?
Esylin
Posts: 45
Joined: Thu Dec 16, 2021 1:21 am

Re: Adding Custom Field and problems

Post by Esylin »

Tony Li wrote: Thu Jun 08, 2023 7:59 am Would it be possible for you to send a reproduction project to tony (at) pixelcrushers.com?
Sure. Once I find a way to reproduce this bug more consistently I'll try to organize a package for this. :)
Post Reply