#Cannot create certain List types

1 messages · Page 1 of 1 (latest)

dense patrol
#

Why can't I make List of Strings in one project but in another I can? What do I need to enable being able to create list of specific variable types?

ivory brook
#

Go to Edit > Preferences > Visual Scripting and see if you can turn off AOT Safe mode see if this allows you but note if you are building for a AOT platform like mobile or web the list might not work correctly in the build if you are using one of these use AOT list instead

dense patrol
ivory brook
#

So then you don't have a Safe Mode option in one of the projects?

ivory brook
dense patrol
#

But I will use AoT mode because I want to build for web and mobile.

#

It's just too tedious to set every element a specific type

ivory brook
#

that way it will allow you to use List of string but still work in the build

dense patrol
#

That would be great

ivory brook
#

You should be able to add this to your project then just add the type in the Type Options which is in Edit > Project Settings > Type Options after that just regenerate the Units

dense patrol
#

Thanks!

ivory brook
#

You're welcome

ivory brook
# dense patrol Thanks!

I don't know if you know C# but if you want any other types you can, Duplicate the script change the parts in yellow to the type name like for example Int which is integer
then change the parts in red to the type name but with lower case characters(Only for basic types bool, int, float, etc) for other types just use the normal name.

dense patrol
#

Thank you!

dense patrol
ivory brook
# dense patrol What is the difference between this and AoT safe mode? Will this work with web a...

The difference is List of string they way Visual scripting handles it is not supported by AOT(Which is why there is the safe mode option) so if you turn of AOT Safe mode and use the List of string it will probably have problems but this should be supported because it telling Unity to save this info for the build the only limit is that you can only use the specific types like if you want a list of integer you need to make a new script to allow you to do so. Hope that's clear