UdonSharp can use List?

Hello, I have been looking for a way to use Lists with udonSharp for several days now.
In the official documentation I don’t see anything mentioning Lists, all I see are Static Arrays.
There are people asking the same questions as me but no answers.

Here is an example that is supposed to work without UdonSharp.

Import dependances : using System.Collections.Generic;

Example : public List<GameObject> ListOfPlayerGameObject = new List<GameObject>();

But in the console I instantly get this error.

System.ArgumentException: Cannot resolve generic arguments on non-method expression

So I was just wondering that maybe it’s not possible to use Lists.

Which means that the dynamic arrays on Udon Sharp don’t work and I find that a real shame.

No lists yet in UdonSharp, as far as I know. There are a few handy methods in System.Array that let you handle arrays a bit easier, though. The functionality is there for whatever you need, but it’s just going to take more steps and more CPU time.

My suggestion is that you write yourself some helper functions that process your arrays in the way you need. You can always append to an array, for example, by constructing a new, larger array and assigning all the contents.

1 Like

Thank you very much for your responsive response.

it helped me a lot, it’s a pity that the lists are not implemented yet.

It doesn’t matter, I’ll deal with it and manage.
Thanks for your advice.