Page 1 of 1

TemplateTools Does Not Exist in the Current Context?

Posted: Tue Nov 28, 2023 4:36 pm
by Unrighteous
Hello again,

I've been trying to figure this out on my own, but I'm afraid I don't know enough about scripting to make any further progress. I'm trying to to add variables to my dialogue database at edit time, and I'm following your instructions in this post: https://www.pixelcrushers.com/phpbb/vie ... 3&t=5556&p - However, I'm getting the error that "TemplateTools does not exist in the current context." This error is in both visual studio and in Unity.

Tested on 2020.3.48f1 and 2022.3.14f1 with Dialogue System 2.2.41.1

I was also wondering how to use the line EditorTools.FindInitialDatabase() - EditorTools exists (deprecated in 2022, is now ToolManager), but vs/unity can't find FindInitialDatabase().

I checked and I do have the script TemplateTools, and it's a public static class in the PixelCrushers.Dialogue namespace (I am using the namespace), but I still can't reference it in other scripts. I'm very lost.

I would appreciate any help, thank you!

Re: TemplateTools Does Not Exist in the Current Context?

Posted: Tue Nov 28, 2023 9:04 pm
by Tony Li
Hi,

Your script should be in a folder named 'Editor' or a subfolder.

Put this line at the top of your script:

Code: Select all

using PixelCrushers.DialogueSystem;
This will give you access to the TemplateTools class, so you can create a template object like this:

Code: Select all

Template template = TemplateTools.LoadFromEditorPrefs();
API reference: TemplateTools

EditorTools is a Dialogue System class. If your script is in an Editor folder and you've added that using line above, you should be able to access it.

Re: TemplateTools Does Not Exist in the Current Context?

Posted: Wed Nov 29, 2023 12:35 am
by Unrighteous
Ah... I should've been able to figure that out, I'll try a bit harder next time.

Thank you!