sschmid / Entitas

Entitas is a super fast Entity Component System (ECS) Framework specifically made for C# and Unity
MIT License
7k stars 1.11k forks source link

Can't generate component which references to the Unity Engine #1040

Closed ntl92bk closed 1 year ago

ntl92bk commented 1 year ago

Jenny doesn't work with this.

using Entitas;
using UnityEngine;

namespace ProjectL.Gameplay
{
    [Game]
    public sealed class PositionComponent : IComponent
    {
        public Vector3 value;
    }
}

But when I changed the component to this, it worked :

using Entitas;

namespace ProjectL.Gameplay
{
    [Game]
    public sealed class PositionComponent : IComponent
    {
        public float x;
        public float y;
        public float z;
    }
}

Here is my Jenny.properties:

Jenny.SearchPaths = Jenny/Plugins/Entitas, \
                    Jenny/Plugins/Jenny, \
                    Jenny\Plugins\Entitas, \
                    Jenny\Plugins\Jenny, \
                    Assets\Entitas, \
                    Assets\Entitas\Entitas, \
                    Packages\Gameplay\Entitas\Entitas
Jenny.Plugins = Entitas.CodeGeneration.Plugins, \
                Entitas.Roslyn.CodeGeneration.Plugins, \
                Entitas.VisualDebugging.CodeGeneration.Plugins, \
                Jenny.Plugins, \
                Jenny.Plugins.Unity
Jenny.PreProcessors = Jenny.Plugins.ValidateProjectPathPreProcessor, \
                      Jenny.Plugins.TargetFrameworkProfilePreProcessor, \
                      Jenny.Plugins.ReferenceAssemblyPathsPreProcessor
Jenny.DataProviders = Entitas.CodeGeneration.Plugins.ComponentDataProvider, \
                      Entitas.CodeGeneration.Plugins.ContextDataProvider, \
                      Entitas.CodeGeneration.Plugins.EntityIndexDataProvider, \
                      Entitas.Roslyn.CodeGeneration.Plugins.CleanupDataProvider
Jenny.CodeGenerators = Entitas.CodeGeneration.Plugins.ComponentContextApiGenerator, \
                       Entitas.CodeGeneration.Plugins.ComponentEntityApiGenerator, \
                       Entitas.CodeGeneration.Plugins.ComponentEntityApiInterfaceGenerator, \
                       Entitas.CodeGeneration.Plugins.ComponentGenerator, \
                       Entitas.CodeGeneration.Plugins.ComponentLookupGenerator, \
                       Entitas.CodeGeneration.Plugins.ComponentMatcherApiGenerator, \
                       Entitas.CodeGeneration.Plugins.ContextAttributeGenerator, \
                       Entitas.CodeGeneration.Plugins.ContextGenerator, \
                       Entitas.CodeGeneration.Plugins.ContextMatcherGenerator, \
                       Entitas.CodeGeneration.Plugins.ContextsGenerator, \
                       Entitas.CodeGeneration.Plugins.EntityGenerator, \
                       Entitas.CodeGeneration.Plugins.EntityIndexGenerator, \
                       Entitas.CodeGeneration.Plugins.EventEntityApiGenerator, \
                       Entitas.CodeGeneration.Plugins.EventListenerComponentGenerator, \
                       Entitas.CodeGeneration.Plugins.EventListenerInterfaceGenerator, \
                       Entitas.CodeGeneration.Plugins.EventSystemGenerator, \
                       Entitas.CodeGeneration.Plugins.EventSystemsGenerator, \
                       Entitas.Roslyn.CodeGeneration.Plugins.CleanupSystemGenerator, \
                       Entitas.Roslyn.CodeGeneration.Plugins.CleanupSystemsGenerator, \
                       Entitas.VisualDebugging.CodeGeneration.Plugins.ContextObserverGenerator, \
                       Entitas.VisualDebugging.CodeGeneration.Plugins.FeatureClassGenerator
Jenny.PostProcessors = Jenny.Plugins.AddFileHeaderPostProcessor, \
                       Jenny.Plugins.CleanTargetDirectoryPostProcessor, \
                       Jenny.Plugins.MergeFilesPostProcessor, \
                       Jenny.Plugins.NewLinePostProcessor, \
                       Jenny.Plugins.UpdateCsprojPostProcessor, \
                       Jenny.Plugins.WriteToDiskPostProcessor, \
                       Jenny.Plugins.ConsoleWriteLinePostProcessor
Jenny.Server.Port = 3333
Jenny.Client.Host = localhost
Entitas.CodeGeneration.Plugins.Contexts = Game, \
                                          Input
Entitas.CodeGeneration.Plugins.IgnoreNamespaces = true
Jenny.Plugins.ProjectPath = ProjectL.Gameplay.csproj
Jenny.Plugins.TargetDirectory = Packages/Gameplay
Entitas.CodeGeneration.Plugins.Assemblies = Library/ScriptAssemblies/ProjectL.Gameplay.dll

And here is an assembly defination: image

ntl92bk commented 1 year ago

Solved!

I gen the Jenny.properties file again, and select

dotnet .\Jenny\Jenny.Generator.Cli.dll

Then keep select these options :

 Keep Entitas.Roslyn.CodeGeneration.Plugins.ComponentDataProvider
 Keep Entitas.Roslyn.CodeGeneration.Plugins.EntityIndexDataProvider