Page 1 of 1

Items & Quests created with incorrect Templates

Posted: Thu Sep 29, 2016 3:37 pm
by ressie
Hello! I'm really enjoying Dialogue System, but I've run into a bug when creating new Item and Quest objects.

On the Quests/Items tab, Menu > New Item or Menu > New Quest don't seem to be working correctly. When either is selected, the object that gets created is always the same: always a Quest that uses default quest template (the one that comes pre-set in Dialogue Creator), regardless of how I've edited the Item/Quest templates in the Templates tab. Even when the created object is called 'New Item', when I roll out the info, it's still a Quest using the default template. I'm also not able to delete the fields I don't need.

Over the past few hours the behaviour has been inconsistent; on a couple of occasions, an Item was created correctly. Often a default Quest will be created that has the fields from the actual template it's supposed to be using mixed into it. Sometimes pressing the Template button will append the correct fields to the bottom. I've deleted all Items/Quests, toggled 'Use Quest System' and restarted Unity but the problem remains.

Does any of this sound familiar? I hope this is clear, but I can provide screenshots or video if that would be helpful.

Re: Items & Quests created with incorrect Templates

Posted: Thu Sep 29, 2016 5:40 pm
by Tony Li
Hi,

Sorry about the issues with creating new items and quests. What versions of Unity and the Dialogue System are you using? I haven't been able to reproduce the issue, so I want to make sure I'm using everything as close to your setup as possible. Are you using any plugins that manipulate Unity's EditorPrefs? Are any errors or warnings logged to the Console window when you add items or quests?

The Templates tab always applies any missing fields to an item or quest. Its primary purpose is to backfill new fields into old items or quests if you've added new fields on the Templates tab.

If you have a project that you think can reproduce the issue, would it be possible for you to send it to tony (at) pixelcrushers.com? Zip up the Assets and ProjectSettings folders, and include reproduction steps if possible. (See this FAQ is you need to pare your project down.)

Re: Items & Quests created with incorrect Templates

Posted: Thu Sep 29, 2016 7:14 pm
by ressie
Hi Tony, many thanks for the quick reply. I'm using Unity 5.4.1f1 and nothing on my end is touching EditorPrefs to my knowledge. No error/warning logs are being shown, even when the Dialogue System Controller's 'Debug' toggle is checked.

But something fishy is going on here! My assumption is that my Dialogue Database has been corrupted, as conditions are no longer working in conversations; valid conditions are showing up as a red line and do not proceed.

I've tried creating a new Dialogue Database, using a new Dialogue System Controller, reimporting all assets, reimporting Dialogue System - and even creating a brand new project, redownloading Dialogue System and trying it fresh - and the problem still persists!

Presumably that can only be possible if Dialogue System is saving some config on my system locally? Is there a chance this has become corrupted and I need to flush it out?

I could send you a zip, but after seeing the problem persist in a brand new project, I'm thinking this is an issue local to this machine.

---

Edit: I did a quick test on my laptop to discover that items were being created as intended, with no issue. I still found however that after modifying the Quest template, quests were being made with their default templates, not the new one I just made.

Re: Items & Quests created with incorrect Templates

Posted: Thu Sep 29, 2016 7:50 pm
by Tony Li
Hi,

The Dialogue System saves the template configuration to Unity's EditorPrefs. It may be that something is corrupt in EditorPrefs. On the Templates tab, you can select Menu > Reset to reset your templates to their default values. You may want to export your current templates to an XML file if you want to save off a copy first.

On your laptop, did your custom additions to the Quest template get saved? Maybe something happened, like they accidentally got deleted.

Are you by any chance using multiple databases with the Sync from DB feature?

I'm afraid I still haven't been able to reproduce this using Dialogue System version 1.6.6.4. What version are you using? (Window > Dialogue System > Help > About)

There may be something fishy going on with your dialogue database. Please feel free to send a copy of your dialogue database file to tony (at) pixelcrushers.com and let me know which conversation to test.

Another option is to temporarily set the Dialogue Manager's Debug Level to Info. This will log a lot of under-the-hood information to the Console window. You could trace through it to see where things go screwy at runtime. Or send me a copy of the Editor.log file after running at Debug Level Info if you don't want to go through it yourself.

Re: Items & Quests created with incorrect Templates

Posted: Fri Sep 30, 2016 9:07 am
by ressie
Hi Tony, by testing this at a work computer, I've established that everything is working fine on it and my laptop. I wasn't clear on how Quests' templates work, so thought there was a problem - but using the Debug mode you mentioned, I see that there are compulsory fields that cannot be removed on Quests, so that's all fine.

So the problem does seem to be with the EditorPrefs on my main machine, where it seems to be referencing the default Quest Template when creating an Item, and is not saving modified Templates.

I've got my eye on EditorPrefs.DeleteKey or EditorPrefs.DeleteAll to debug the issue. I had a look at the Unity EditorPrefs in the registry but it's all above my head I'm afraid! Will test when I get home.

Re: Items & Quests created with incorrect Templates

Posted: Fri Sep 30, 2016 9:45 am
by Tony Li
Hi,

I've never even looked at EditorPrefs in the registry myself; I just treat it as a black box. Perhaps some anti-spyware or anti-virus software is preventing Unity from making registry changes?

Re: Items & Quests created with incorrect Templates

Posted: Fri Sep 30, 2016 5:27 pm
by ressie
My AntiVirus software has no features that are affecting programs' permissions, so it looks like that's not it either.

I'm uncovering more strange behaviour, and it's easier to just show it in a video, so here we go:

https://youtu.be/X-AtNMqHtIQ

To preface that video - by resetting the Templates a couple of times, Items are now being created correctly (yay!). But changing any fields different from the default template causes them to abruptly become Quest templates. This is in a new, clean Dialogue Database.

At this point I've wiped my editor prefs several times, reinstalled Unity, deleted and reimported Dialogue System, but whatever I do it doesn't seem to be affecting anything.

Edit: I've just done a quick test on my laptop and the bug shown in the video occurs even with a new, empty Unity project and a fresh download & import of Dialogue System.

Re: Items & Quests created with incorrect Templates

Posted: Fri Sep 30, 2016 6:14 pm
by Tony Li
Hi,

Ah, thank you for the video. That clarifies the issue.

The short answer is: Don't rename the "Is Item" field.

The long answer is: The Dialogue System was originally based on a dialogue writing product called Chat Mapper. It's a great product with a robust data structure used very successfully by many commercial games, so it gives the Dialogue System a leg up when it comes to dialogue. However, Chat Mapper doesn't natively do quests. To maintain compatibility, the Dialogue System co-opts the Item table for quests. This means the Item table serves double duty for items and quests. The Dialogue System distinguishes between them based on the value of the "Is Item" field. If "Is Item" is true, the table element is an item. Otherwise it's a quest.

Sorry I sent you on a wild goose chase with the antivirus and registry ideas. If you leave "Is Item" untouched, everything should be fine.

Re: Items & Quests created with incorrect Templates

Posted: Fri Sep 30, 2016 6:26 pm
by ressie
Gah! It's all so simple after all! Thank you Tony for persevering through my strange issues. I realise now that the template 'bugs' I was experiencing were simply due to removing what were actually required fields from the default templates. Knowing this, I've already got things back to working as expected.

Thanks again! :D

Re: Items & Quests created with incorrect Templates

Posted: Fri Sep 30, 2016 7:46 pm
by Tony Li
Glad we got it sorted out. I don't want to make the field read-only, since some developers don't use quests and do unusual things with the Item table, but I'll at least add some kind of confirmation warning to the next release if the field is about to be edited.