Enums created inside assemblies are not exposed to the scripting environment

Hey there! We’re experiementing with visual scripting for our project in Unity.

We’re using Unity 2021.3.5f1 and Visual Scripting 1.7.8

We’re having an issue where enums that are created in a custom assembly is not exposed and visible in the visual scripting environment. The Assembly is included, all nodes have been regenerated, and other types in the assembly is visible and accessible. I can make it accessible by moving the enum to the default unity assembly, but not otherwise.

I can’t find any material online regarding this behaviour, has anyone had similar experiences and issues?

You added the assembly, but did you also added the enum in the types? It is in the Project Settings panel on top of the assemblies.
8488388--1129196--upload_2022-10-4_7-50-33.png

In some versions of visual scripting, just adding the Assembly to the Node Library section, will gather the types, but not in all versions.

I did make an attempt, but the enum type isn’t listed in the dropdown for the Type Options.

where does this custom assembly come from?
is the error with the custom nature of the assembly not being seen i wonder

I suspect something similar, that there might be a bug or difference in behaviour in VisualScripting’s reflection routine that misses enums when they are part of an assembly.

We’ve separated out our project into separate assemblies to clarify some codebase bounderies and improve recompile times. As far as i’m aware it’s a pretty standard and recommended approach to Unity development.

what is the actual property you want to change?

I was able to try a public enum in an assembly and everything work in Visual Scripting package 1.7.6. haven’t tried in 1.7.7 or other versions. This is how it look like on my side.

This is my setup.

I have this basic enim in a c# file named MyEnum.cs

namespace MyNamespace
{
        public enum MySeason
        {
            Spring,
            Summer,
            Autumn,
            Winter
        }
}

My Assembly is just set with the default Values. If your have only Editor in it, it may be the cause of the problem.

I have only set the Assembly to be in my node library. Did nothing for the type.

Clicked Regenerate and I was able to see it.

If it still doesn’t work, I would like to see what version of the visual scripting package you have, and the Operating system you are using.

1 Like

Try turning off AOT Safety mode and see if that changes anything. Perhaps UVS considers the assembly to be AOT unsafe and filters certain results out.

ericb, thanks for the verification, makes me think there’s something special about our project configuration that makes this happen.

PanthenEye, i’ll try that out!

Where can i find the AOT Safety mode setting in 2021.3.5f1 with visual scripting 1.7.8?

Either in Preferences or Project Settings under Visual Scripting section. I don’t recall which one.