sschmid / Entitas

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

Jenny doesn't work in Unity + "Could not load file or assembly 'Entitas'" #1022

Closed Niek352 closed 1 year ago

Niek352 commented 1 year ago

I Try to use new entitas in Unity And Jenny Gen throw this exceptions

To Reproduce

  1. Open project folder
  2. dotnet Jenny.Generator.Cli "commands like: doctor, gen, fix"
  3. And some errors thrown.

And if i try to gen from unity i have this exception

  1. Tools/Jenny/Generate image

Screenshots image

Entitas Version

Additional context Unity 2021.3.6f Dotnet SDK updated to highest

On AssetStore version (1.12.3) all work correctly;

sschmid commented 1 year ago

Hi! Regarding the first issue when generating in Unity: Entitas 1.14.0 now comes with Roslyn code generators by default. For now this means: generate code using the terminal:

cd My/Project
dotnet Jenny/Jenny.Generator.Cli.dll gen

Running roslyn in Unity currently results in this issue.

The 2nd issue Could not load file or assembly 'Entitas, Version=1.0.0.0 means that your Jenny.properties is not set up correctly and it doesn't know where to find Entitas.dll.

Please update the Jenny.SearchPaths, see Match-One

Niek352 commented 1 year ago

Hi! Regarding the first issue when generating in Unity: Entitas 1.14.0 now comes with Roslyn code generators by default. For now this means: generate code using the terminal:

cd My/Project
dotnet Jenny/Jenny.Generator.Cli.dll gen

Running roslyn in Unity currently results in this issue.

The 2nd issue Could not load file or assembly 'Entitas, Version=1.0.0.0 means that your Jenny.properties is not set up correctly and it doesn't know where to find Entitas.dll.

Please update the Jenny.SearchPaths, see Match-One

I already use Jenny.properties from Match-One, Here is my properties and folder structure image image image

sschmid commented 1 year ago

Your Jenny.Searchpaths should point to Assets/Entitas so it can find Entitas.dll, see Match-One Jenny.properties, line 3 https://github.com/sschmid/Match-One/blob/main/Jenny.properties#L3

sschmid commented 1 year ago

I see you have Entitas in a Plugins subfolder, update your Jenny.Searchpaths accordingly

sschmid commented 1 year ago

e.g

Jenny.SearchPaths = Jenny/Plugins/Entitas, \
                    Jenny/Plugins/Jenny, \
                    Assets/Plugins/Entitas
sschmid commented 1 year ago

Explanation:

Jenny dynamically loads dll specified in Jenny.Plugins. It tries to find those by searching in all folders specified in Jenny.SearchPaths. Some plugins may have dependencies that will also be loaded, e.g. Entitas.CodeGeneration.Plugins depends on Entitas. In order to find all plugins + their dependencies you need to specify all paths in Jenny.SearchPaths

Niek352 commented 1 year ago

Ok it finally work, thx