Is it possible to use Generic Dictionaries in Custom Classes in Visual Scripting?

I made a ProfileState class to store a guid string, and also a Dictionary with key string and value ProfileState.

[System.Serializable]
public class ProfileState
{
public string guid;

public static Dictionary<string, ProfileState> profileStateDictionary = new Dictionary<string, ProfileState>();

public Profile profileData;
}

But when I try to create a generic Dictionary and set a Profile State Dictionary, I get a type mismatch error:

InvalidConversionException: Cannot convert from ‘Unity.VisualScripting.AotDictionary’ to ‘System.Collections.Generic.Dictionary`2[System.String,ProfileState]’.
Unity.VisualScripting.ConversionUtility.Convert (System.Object value, System.Type type, Unity.VisualScripting.ConversionUtility+ConversionType conversionType)

I see from the error that you can’t create a Generic Dictionary and set it equal to a Profile State Dictionary.

I ended up writing a Custom Node that creates a string/ProfileState dictionary for me, and that seemed to resolve the issue:

9381458--1312040--upload_2023-10-1_12-29-53.png

Is this the best approach though? I would have to create a Custom Node every time I wanted to make a dictionary for a different type of State. I also have to make Custom Nodes to Add and Remove Dictionary Items for each State type. Just feels like a bit of kludge.

I could make a Generic Dictionary and then store that data in a scene variable, but I was hoping to use the Profile State custom class.

Is there an easy way use Unity Visual Scripting to make a Generic Dictionary, and still store the data inside of a custom class?

Try using an interface like ICollection or IDictionary

i did make a node like this

9396038--1314947--2023-10-08 11_44_02-2D Practice - SampleScene - Windows, Mac, Linux - Unity 2022.2.18_ DX11.png

i could give it to you if you want