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.

How do I make changes to components?

See original GitHub issue

How do I make changes to components? I had a component and I wanted to change it:

public sealed class ViewComponent : IComponent { public GameObject gameObject; }

to

public sealed class ViewComponent : IComponent { public Transform tr; }

But I got a lot of compiler errors, although I fixed the code of all the systems. I also tried to remove the generated code and generate it again, but without success

How to correctly change the members of a component?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
koden-kmcommented, Apr 23, 2017

In my project I have been using some defines that I can set to disable all my Entitas code when making changes to components or systems.

It is a bit of extra work, but has has helped with refactoring and Entitas upgrades. I disable Systems while refactoring Components. Then after I regenerate the new components, I can enable systems again. It seemed a bit nicer than moving code in and out of the project.

#if !MYGAME_DISABLE_ENTITAS_COMPONENTS

public sealed class ViewComponent : IComponent {
   public GameObject gameObject;
}

#endif

And also one for systems.

#if !MYGAME_DISABLE_ENTITAS_SYSTEMS

public sealed class CommandLogicSystems : Feature {
    // ...
}

#endif

I added those defines to my Entitas source file templates to keep it easy.

3reactions
FNGgamescommented, Apr 22, 2017

Upcoming changes to the code generator will likely improve this in future, but for now, here is the process I use when i change my components (e.g. renames, new fields, deletions etc).

  1. Move Components, Systems and GameController.cs to a folder outside your project (e.g. desktop). Or create a folder called “StreamingAssets” in your assets folder and move them to here (Unity will not compile the code in this folder) .
  2. Delete the contents of your Generated folder
  3. Regenerate contexts (ctrl-shift-G)
  4. Move Components folder back
  5. Make changes to your components
  6. Regenerate components (ctrl-shift-G)
  7. Move Systems and GameController.cs back and you’re done.

You may have compile errors at this point, caused by your component changes, but they won’t be in generated code, they’ll be in your systems code which you are now free to go and fix.

Between each of these steps make sure you allow Unity to compile. The code generator will not run with compile errors present or during Untiy compilation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Edit main components
From there, you can apply any changes you want to the main component. Select an instance in the current file. Open the Design...
Read more >
How to edit components in Figma
If you want to edit a certain component, just go to the root component frame and edit it. Any change you add, Figma...
Read more >
How Do I Edit an Instance of a Component in Figma?
To edit an instance of a component, simply select it and make your changes. When you edit a component, any changes you make...
Read more >
How Do You Edit a Component in Figma?
In the right sidebar, click on the “Edit component” button (it looks like a pencil). 3. Make your changes in the component editor....
Read more >
How to edit components in Figma
Right-Click on your instance and select Go to the main component · Now, add your changes to the component. · Go to the...
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