question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New Code Generator available in the Asset Store

See original GitHub issue

New Code Generator available in the Unity Asset Store

Hi guys, I’ve just got an Email from Unity. The new Entitas version is available in the Unity Asset Store including the first public beta of the new Code Generator! Here’s a quick guide to get started. Better docs + Video Tutorials are coming very soon. This version was uploaded with Unity 2017.2, older version will be available soon!

First Steps

  • Open Unity
  • Ceate a new project
  • Create a new folder called Libraries (or update the default paths in Entitas.properties later)
  • Download Entitas from the Asset Store
  • Move the downloaded package into the libraries folder you just created
  • Create a new Component : IComponent
using Entitas;

public class IdComponent : IComponent {
    public string value;
}
  • In Unity select the menu item Assets -> Open C# project
  • Open the the Entitas Preferences and enable all Plugins
  • Check the searchPaths in Entitas.properties if you’re on windows (the default ones are for Mac)
  • Press the green generate Button
  • You’ll find the generated code in Sources/Generated

Using the new code generator

  • Move Libraries/Entitas/CodeGenerator.zip to your project root (one folder above the Assets folder)
  • Unzip it (on Windows make sure to right click -> Properties -> Unlock to safely unzip)
  • Open Entitas.properties (located in the project root folder)
  • Add CodeGenerator/Plugins/Entitas.Roslyn to the searchPaths
  • Add Entitas.Roslyn.CodeGeneration.Plugins to the plugins
  • Find the DataProvider called Entitas.CodeGeneration.Plugins.ComponentDataProvider and add .Roslyn after Entitas -> Entitas.Roslyn.CodeGeneration.Plugins.ComponentDataProvider
  • Do the same for Entitas.CodeGeneration.Plugins.EntityIndexDataProvider -> Entitas.Roslyn.CodeGeneration.Plugins.EntityIndexDataProvider
  • We just plugged in the Roslyn Code Generator Plugin and are using the DataProviders
  • Open the terminal and cd into your project root
  • run CodeGenerator/entitas.exe doctor
  • on a mac run mono CodeGenerator/entitas.exe doctor
  • You should see No problems detected. Happy coding :)
  • If not, check your searchPaths, especially if the point to the correct Unity location
  • run CodeGenerator/entitas.exe gen -a (prepend mono when on a mac)
  • It will generate using the new code generator. -a will ask you Again ? (y / n)
  • Press y if you want to generate again (e.g. after adding more components)
  • Press n to terminate the programm

What you should try

The new code generator will be able to generate the latest changes in your code even when there compile erros. Try it yourself!

using Entitas;

public class IdComponent : IComponent {
    public string value;
}

After generating change the field type from string to int which will result in errors. Switch to the terminal and hit y to generate again. Open the generated file GameIdComponent to verify and see for yourself.

The errors are all gone. You can switch the type back to string and intentionally add more compiler errors by smashing the keys on your keyboard

using Entitas;

// more compiler errors
fdsf         dh aksjhdgk sh
  fsdf

  sdfkjhgaskfjhg

public class IdComponent : IComponent {
	public string value;
}

Switch to the terminal and hit y to generate again. The new code generator will be able to generate anyway.

Add more components, rename them, delete them, add and remove fields, it should all work seamlessly!

Happy coding 😃

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:8
  • Comments:30 (13 by maintainers)

github_iconTop GitHub Comments

3reactions
sschmidcommented, Nov 6, 2017

Entitas 0.43.0 available to address most of the initial feedback! Asset Store version should be available in 2-4 days

2reactions
jwvanderbeckcommented, Nov 4, 2017

Running Generate from inside of Unity freezes the Editor.

Read more comments on GitHub >

github_iconTop Results From Across the Web

New Code Generator available in the Unity Asset Store
The new code generator will be able to generate the latest changes in your code even when there compile erros. Try it yourself!...
Read more >
AI generators are on the asset store!!
Not entirely sure why you need to buy an asset to use AI tools (you can use free stuff), but we have now...
Read more >
Entitas | Game Toolkits
The core library is great and easy to learn. However, the code generator is difficult to configure, and even moreso to extend. There...
Read more >
Tools 23 - QR Code Generator
Use the Tools 23 - QR Code Generator from Brain Station 23 on your next project. Find this utility tool & more on...
Read more >
Text to script generator and code optimizer powered ...
Get the Text to script generator and code optimizer powered by Chat GPT package from THEUS Games and speed up your game development...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found