#Is there anything else besides
1 messages ยท Page 1 of 1 (latest)
Nope, just specifying the [RegisterGenericComponentType(typeof(component)] is enough
Unity should implement a hook for it then
Reflection can be used to determine generic component usage but it's a bit complicated.
The Job system for instance does scan for generic closed forms however you cannot deduce all forms statically
It doesn't matter, even if you registered dynamically il2cpp wouldn't work
Some interface that will return Innumerable if types to register
When a generic is closed from a generic method, you cannot statically or dynamically determine without speculatively registering every combination
It doesn't matter, even if you registered dynamically il2cpp wouldn't work
IL2CPP will work in 2022.2 as full generic sharing is enabled as a fallback by default
Previously you're correct, IL2CPP would not know how to generate the correct methods. Now it can dynamically but it is slower of course
So if I manually add a new generic type to type manager at runtime it'll work?
Before init is called?
Ah, no IL2CPP's full generic sharing support is only the first piece of transpiling with generics. We don't allow new types to be registered with the type manager at runtime currently
Yeah that's what I think issue is asking for
Side note, did you fix register generic type across assemblies
If you have use cases for that I'd be interested to hear them ๐
Not really
This was broken in 0.50 and 2021
What I'm interested is creating generics with type argument of some class
Might only have been class based components though
My bad then!
For example back in 0.51 I wanted to implement a component with argument where T : EntityCommandBufferSystem
While struct is tag
Actually not tag
But pointer holder
So I could create Singleton for each ECB system
And get them from anywhere
Every system actually has an Entity now attached to it
@forest canyon Hmm that is interesting. That should be possible (i.e. creating a tag component with an arbitrary generic T -- what error did you get?)
No errors
In 0.51 you can't register generics dynamically before type manager init runs
It only got assembly attributes
Ah I see, you'd like to iterate over a list of types found at boot
Which can't be modified
Yes, I want to be able to pass data without assembly attributes
Just some interface like old conversion system used to register prefabs
Same thing for generics to register
So devs can implement any logic behind getting those types
Seems reasonable. The only way to do that today would be to add your own code generation step to add those component registrations which is not ideal.
Registering components dynamically is something we've had internally but hasn't had good use cases so it's support has been on and off (and mostly off as it is now). But aside from a few ugly bits that slow addition down it's not off the table as do-able
I hope it'll make it to production. Hate to use harmony for that ๐