#calling a method on a SystemBase from a MonoBehaviour?

1 messages · Page 1 of 1 (latest)

golden stone
#

Or just doing anything on a system from mono...

keen scarab
golden stone
#

Its for UI toolkit

keen scarab
#

instead: call monobehaviour from system

#

this will give you much cleaner workflow

golden stone
#

How do i access UI from system then?

#

It cant exist as entity

keen scarab
#

create it there, static reference

#

up to you

golden stone
keen scarab
#

public static MyType instance;
Awake() { instance = this; }

#

or

#

Object.FindObjectOfType<MyType>()

late fiber
#

There are times we have to pass data from Mono world to ECS world. Currently I don't directly inject that data into the ECS components, but I use some persistent collections to cache the data from Mono world (I use pubsub for this). The SystemBase Update will retrieve data from those collections then schedule jobs normally. SystemBase Update runs on main thread anyways, we don't have to worry about race condition. But don't ever pass those persistent collections to jobs, allocate other collections if your jobs require them.

lament vine
late fiber
#

For example something like this