0
Fixed

Missing list types in type option tree

Andy Buchanan 3 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 27

Probably me just being blind but I don't see any container types listed for variable types, and I can't seem to cast to a base object type either. How/where can I store containers I wish to share between machines/states?

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
GOOD, I'M SATISFIED

Thanks for the help!

Satisfaction mark by Andy Buchanan 3 years ago

I am not a coder, but are you talking about this kind of stuff?

https://msdn.microsoft.com/en-us/library/ff648211.aspxhttps://msdn.microsoft.com/en-us/library/ff648211.aspx

I still don't understand it, way over my head that stuff at the moment.

No, that doesn't seem relevant; I have set up a List<GameObject> and a List<float> ( from the containers selection ) in a flow state and I'd like to store them in a variable for use by other states.

For now I have worked around this apparent omission by using custom states to trigger the essential processing where the data is. This is not a good design and not sustainable. My other alternative would be to write a custom c# class to encapsulate my data, assuming I can store scriptable objects in the variables. Though at that point I'm doing more or less what I'd do in Playmaker. :-) 


Pending Review

Hi Andy, welcome to the community!

I'm sorry, but I don't understand what you mean by "container". Do you mean lists? Are you having trouble creating a list type variable?

Hi Lazio, 

Yes, exactly this; sorry Container is c++ parlance, I guess I should be saying Collection when I'm in c# land :-)

I cannot seem to create a variable of List ( or any other collection ) type, they are not options in the type menu.that pops up.

I have created List<> literals I'd like to store as object variables so all the graphs on the object can access them.

-Andy


Ah, I see!

You can use the Set Variable units to assign your literal to a variable. The variables are not strongly typed, and in fact they don't even have to exist before play mode. This means you don't have to declare a properly typed variable before your graph runs.

However, I'll take good note that list types are not included in the type option tree and try to fix it in v.1.0.5.

Okay, I've tried that I I see you're right, I was thinking it didn't work because the type showed as 'null', but indeed the set & get are working fine.

Thanks!

Cannot Reproduce

Just checked, and I can find the list types in there as expected:

Please let me know if you can't find them in your installation.

I can't select collection types in the drop down, they're not listed. They show up fine once they've been assigned by the graph though i.e. I can't use the variables window to store pre-set list data since I can't select the type, I have to use a List literal in the graph and assign it to the variable instead.  I'm specifically trying the object variables, but the other variable scope types seem to be the same. ( Bolt 1.03 / Ludiq 1.0 / Unity 2017.1.0.p3 )

+1
Working on Fix

Ah I see! The problem is that they're not listed in the hierarchy.

You can either search for List< to display all generic lists (or for example List<int> for your case).

Otherwise, they should be under System > Collections > Generic, but they're not. I'll try to fix this.

FYI The search is not finding List<> entries for me either.

+1

Are you typing List< or List<>? There are no List<> types.

Should show up like this:


No, not for me sorry, though even elsewhere I do't get all the possible expansions you have there, just the base types, GameObject and a handful of others. I did get an error the first time I added the package in (though it seemed okay when I re-ran it), perhaps I have a damaged configuration?

Hm, odd. It's also possible I fixed it as a side effect of another bugfix for v.1.0.4.

I'll be pushing the next version to the store today (so it will probably be out early next week), let me know if you still experience the issue then. It should be both in the search and in the hierarchy.

Okay thanks, I'll grab the new version when it's available

Hi, I've applied the new update but this is still not working for me. Have I missed a step? I let it do all the update sit wanted and re-ran the setup wizard for good measure.

Nuked Library directory and all Bolt files and re-installed the new package. Still no dice.

Hi Andy,

Have you downloaded the new version from the asset store before running the update wizard?

The update wizard does not automatically download the new version from the store; it applies additional steps after the download.

Here's how it looks on a vanilla 1.0.4 install after generating the unit options database:


Yes, I downloaded the new package and installed it fresh. First as an update, then later as a completely fresh install, with all the original files vaporised. The About box displays the correct version number, but I don't get the Collections item in the system list like you have here. Hmmm.

Are you using .NET 3.5 or .NET 4.6?

Can you send me a screenshot of your assembly options in Tools > Bolt > Unit Options Wizard?

I have tried both .NET versions with same result.

UPDATE. I have the Collection now BUT this is only because I have switched my build platform back to "PC, Mac & Linux Standalone", when I switch it to my usual target ( PS4 ) the Collections entry is not there.




+2

Ah, I see what's going on. You have AOT Safe Mode enabled. This mode will remove generics from available types when building for AOT platforms. You can disable it in Tools > Ludiq > Project Settings.

Yes, that's the fix. Thanks! :-)

Not only generis are removed when AOT Safe Mode enabled. For example, non-generic version of IEnumerator doesn't appear in the type list when AOT Safe Mode.


That's because Interfaces (ISomething) are just as unsafe in AOT, because we can't stub their underlying implementation reliably.

But the good news is that script generation will fix all of this and remove the need for AOT safe mode altogether! It's coming sooner than expected, too, so keep an eye out! ;)