Page 1 of 1

Files parameter in the All Fields actor tab

Posted: Tue Dec 03, 2019 11:24 am
by gregoired
Hello there, I bought your asset recently and so far it seems very powerful. I'd like to add additional variables for the actors, like additional textures and scriptables object. I saw you can define a parameter as a "Files" but I dont really understand how I am supposed to bind them to an object in my project. Is it something we can do or do I understood it wrong ?

Re: Files parameter in the All Fields actor tab

Posted: Tue Dec 03, 2019 1:23 pm
by Tony Li
Hi,

Thanks for using the Dialogue System!

The Files type probably won't be helpful. The Dialogue System's data structure is the same that's in the professional dialogue authoring system called Chat Mapper. In Chat Mapper, the Files type is a string containing a list of names, such as "[cat, dog, bird]". Since it's a string, it doesn't directly reference assets.

Internally in a dialogue database, all fields are stored as strings. The advantage of this is that you can import and export text formats -- for example, Chat Mapper XML, or CSV files to send to translators or grammar checkers -- without losing any references. But the disadvantage is that you can't have direct references to Unity assets such as ScriptableObjects. Here are some workarounds:
  • Put your ScriptableObject or image assets in a Resources folder or asset bundle. Store the name of the asset in the custom field. At runtime, use DialogueManager.LoadAsset() to access it. (DialogueManager.LoadAsset is like Resources.Load, but it can also transparently load from assetbundles -- and in a future update it will also be able to load from addressables.)
  • Or create an additional ScriptableObject type that contains a list of your assets. At runtime, you can look up assets from this list asset.
  • Can you define custom field types. While internally they're still stored as strings, this can make data entry and validation much easier

Re: Files parameter in the All Fields actor tab

Posted: Tue Dec 03, 2019 1:35 pm
by gregoired
All right thank you for your quick answer !
Do we have access to the source code somewhere if I want to tweak some components to make it work with my current implementation ?

Re: Files parameter in the All Fields actor tab

Posted: Tue Dec 03, 2019 1:42 pm
by Tony Li
Yes, all Pixel Crushers products include complete source code. (However, the evaluation version use precompiled DLLs.)

If you want to write a custom field type, the Templates folder has a starter template script, and the Scripts/Editor/Fields folder has an example.

Re: Files parameter in the All Fields actor tab

Posted: Tue Dec 03, 2019 3:43 pm
by gregoired
Thank you !