andoowhy / egocs Goto Github PK
View Code? Open in Web Editor NEWEgoCS: An Entity (GameObject) Component System framework for Unity3D
License: MIT License
EgoCS: An Entity (GameObject) Component System framework for Unity3D
License: MIT License
What is the exact issue? And why does the framework behave differently depending on this?
So it's invisible in the project view
Hi Andy, by any chance is there a tutorial for EgoCS available? Thanks.
Hello, curious what the best way to do accomplish something would be.
In an RTS style game, I have a Selectable EgoComponent
that has a public GameObject SelectionGraphic
on it that displays a Projector
on the ground when the unit is selected.
Currently I'm passing in the SelectionGraphic
in a script that runs when the Scene is instantiated and gets passed to the SelectableComponent
:
Ego.AddComponent<SelectableComponent> (g).selectGraphic = this.selectionGraphic;
I would love to be able to set the SelectionGraphic
public variable in the editor, but it appears when I do this method it gets overwritten at run time. Is this true? Is doing it via script the only way?
Thanks!
One thing I've see a lot in other ECS implementations is the ability to add or remove components from entities as they flow through systems. Some examples include removing movement components to freeze entities, adding "hostile" components to make entities attackable/aggressive, placing and removing debuffs from targets, etc.
But I can't see any simple way to do this with EgoCS. This wouldn't inherently be such a big deal, except that I also can't see any way to get a component's Entity (GameObject), which I could have used to addComponents to...
For the project I'm working on now, these things are kind of crucial.
the wiki insists that you use Ego.SetParent(this.transform, child.transform) instead of the standard child.transform.SetParent(this.transform) but Ego.SetParent(this.transform, child.transform) doesn't actually set the parent child relationship Unity world/hierarchy wise so you have to use both, not sure if this is error on the wiki or a bug in the code
I have some code designed to run at edit time and part of it needs to destroy components and GameObjects at edit time, but EgoCS only has the Ego.DestroyGameObject() and Ego.DestroyComponent(). which I've tested and they seem to not work correctly at edit time. I was wondering how EgoCS would handle me using Unity's built in DestroyImmediate() to do this task and also if I need to be concerned about EgoCS at all (using Ego.AddGameObject() and the like) in the code that will only ever run during edit time assuming i don't use the helper functions like HasComponents(). At start() during runtime do the egoComponents and other related systems check things like what components are already attached. The code I'm doing this for is a rogue-like game me and a partner are making and the way I'm designing the procedural area generation is by having a bunch of templates of rooms as prefabs (with the individual tiles as child objects and randomly choosing between them at runtime. The way I'm setting them up is attaching a script with a custom editor class to allow me to auto generate some aspects of the rooms while allowing me to tweak them in the scene, and this of course involves a lot of function calls that involve things like adding/instantiating Components and gameobjects as well as destroying them
Hi, I'm new to EgoCS and UniRX but I want to learn new things.
Is EgoCS would work with reactive/observable fields in POCO's components? I think that can be problem with GameObjects/MonoBehavoiurs created in runtime, but I hope that I'm wrong.
Hey! I just stumbled across EgoCS after finding your initial reddit post about it. I've also looked at Entitas in the past and felt it was overkill for my needs, and I wanted to preserve the visual debugging Unity gives you in the inspector. So I really dig what you're doing here and how easy it is to get started.
I've just been playing around and I was wondering what you thought about a subclass of EgoSystem
that circumvents the need to do:
public override void Update ()
{
foreach( var bundle in bundles )
{
var transform = bundle.component1;
var movement = bundle.component2;
// ...move it by the velocity in its Movement Component
transform.Translate( movement.velocity * Time.deltaTime );
}
}
In favour of something more like:
public override void Update(Transform transform, Movement movement)
{
transform.Translate( movement.velocity * Time.deltaTime );
}
For most of the cases I find myself in, I only want to work on one component bundle at a time. The code that facilitates this is (as you might expect) fairly trivial, but seems it would save a lot of time (for me at least).
Obviously, I can always just do this for myself, but I was wondering whether it might be worth including in the library? I'm unsure myself, as it isn't really core functionality, but I'd like your input โ.
With normal monobehaviours, if you disable the GameObject, it's monobehavior scripts stop calling their Update() loops. Is there a good way to do this with EgoCS's Systems so they automatically skip disabled entities? I suppose I could put
constraint.ForEachGameObject( ( egoComponent, transform, movement ) =>
{
if (!egoComponent.gameObject.activeInHierarchy)
return;
before all my logic, but I wasn't sure if there was a better way.
One thing I've found really handy in other ECS libraries is the convenience of Assemblages/Blueprints. Basically they are Entity factories which are super handy for creating common Entity types, like "soldier", "supersoldier", "tank", and even "player" (in multiplayer games).
The key thing though is that these Blueprints/Assemblages can construct their entities based on data passed in from JSON/XML/CSV, making it much easier for designers to create and tweak new entities without having to get a programmer to implement every change.
I'd find that sort of thing to be really valuable when using EgoCS.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.