#Roslyn Generate Monobehavior

1 messages · Page 1 of 1 (latest)

covert depot
#

I wonder how did DOTS achieved that the generated Authoring Component can be directly added in gameobject's addComponent Menu

#

We have our own roslyn sourceGen solution. But can't managed to do the same. Now we have to declare another partial class for it in order for unity's AddComponent to pick it up.

#

LIke this:

#

SelectiveComponentDataAuthoring that it inherits from is just a regular monobehavor abstract class.

rare spade
#

unity creates a hidden cs file with structName_Authoring.cs

#

GenerateAuthoringComponent is deprecated. do you want to get the functionality back in 1.0?

#

source is btw available in com.unity.entities@0.51.1-preview.21\Unity.Entities\SourceGenerators\Source~\AuthoringComponent

covert depot
covert depot
#

This one?

rare spade
#

I don't know what that's supposed to be. These are the sourcegen files for GenerateAuthoringComponent. Why do you need that when you're still on 0.51? the attribute just creates the file you linked in the 2nd screenshot. standard monobehaviour and the file name is the same as the class name so you can add it as component. that's pretty much it

covert depot
#

With all due respect I believe you misunderstood my question.

#

I'm asking how did unity's roslyn generator managed to allow the generated Authoring components able to be found in AddComponent menu.