Improbable Icon

Class With WorkerType must be Monobehaviour?

v12-0-1

#1

Hi,

I just want to know if it’s a obligation when I have a class with a WorkerType (client or worker), she must derive from Monobehaviour.
Or i can can create my class via a constructor.

Thanks a lot


#2

Hi @spigot,

The WorkerType attribute only applies to MonoBehaviours that are part of prefabs that SpatialOS spawns.
If you want your own classes to be able to do custom things per-worker, you can inspect SpatialOS.Configuration.WorkerType, which will be set to UnityClient or UnityWorker depending on what’s running.

Hope that helps!
-J