#Is there anything else besides

1 messages ยท Page 1 of 1 (latest)

mortal raptor
#

Nope, just specifying the [RegisterGenericComponentType(typeof(component)] is enough

forest canyon
#

Unity should implement a hook for it then

mortal raptor
#

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

stiff glacier
#

It doesn't matter, even if you registered dynamically il2cpp wouldn't work

forest canyon
#

Some interface that will return Innumerable if types to register

mortal raptor
#

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

stiff glacier
#

Before init is called?

mortal raptor
#

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

stiff glacier
#

Yeah that's what I think issue is asking for

#

Side note, did you fix register generic type across assemblies

mortal raptor
#

If you have use cases for that I'd be interested to hear them ๐Ÿ™‚

forest canyon
#

Not really

stiff glacier
#

This was broken in 0.50 and 2021

forest canyon
#

What I'm interested is creating generics with type argument of some class

stiff glacier
#

Might only have been class based components though

stiff glacier
forest canyon
#

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

stiff glacier
#

Every system actually has an Entity now attached to it

mortal raptor
#

@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?)

forest canyon
#

In 0.51 you can't register generics dynamically before type manager init runs

#

It only got assembly attributes

mortal raptor
#

Ah I see, you'd like to iterate over a list of types found at boot

forest canyon
#

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

mortal raptor
#

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

forest canyon
#

I hope it'll make it to production. Hate to use harmony for that ๐Ÿ˜