#ECS - Monobehavior simplification

1 messages · Page 1 of 1 (latest)

keen oak
#

I have some ECS-related questions, not urgent but it seems like stuff I should know.

  1. Is there a way to invoke events from an ISystem? Stuff like actions ans delegates. I use the event system a lot and it seems that I will have to use a SystemBase system in order to do it
  2. How do you get a reference to an ISystem from a Monobehavior?
  3. Is there an ISystem or Job version of Tasks, Awaitables or IEnumerators where you can delay code execution until some condition is met?
  4. Does every ECS code have to be constrained within the OnCreate, OnUpdate, OnDestroy, OnStart/StopRunning functions? For example, in a monobehavior code, there are stuff like OnTriggerEnter/Stay/Exit events, but in ECS I always have to add flags to constrain the OnUpdate method from calling an ITriggerEvent every update call so that I can use a TriggerEnter/Exit-like logic as opposed to its default OnTriggerStay-like logic.

Of course there are “workarounds” to all of these, but given that I'm only barely a year into DOTS, I feel like there are some tricks I don't know about and they would really come in very handy.

odd gorge
#
  1. You really should not do this, even on systembase, work within the confined of ecs and you'll have a much better time.
  2. You don't, systems are not really meant to be accessed or referenced at runtime. It breaks dependency management, so it's often not safe (accessing data via systems is only safe in onupdate unless you directly use EM), and just goes against the core ecs principles.
  3. The condition is if the data exist, if it doesn't, it doesn't run. There is no integration with task and other async context.
  4. No
keen oak
#

Thanks @odd gorge

opaque bear