How is everyone handling setting up their environment in regards to positioning their entities? In the past, I haven’t done anything more than positioning items in my unity project and copying the coordinates to the scala entity spawn code. I feel like their has to be a better way.
YouI could write a script which iterates over the scene objects and adds them to a snapshot.
Caveat: I wrote it very quickly, but it would be a start
Edit: alternatively you could still generate your snapshot in a similar way to a pre-9.0 world app, but just written in C# instead.
@morrison You said pre-9.0 I would write the snapshot in c# instead but the script you linked is in C# as well. Did you mean scala?
An old-school scala world-app could programmatically spawn entites on startup.
Now that workers can spawn entites at run time; you could seed your snapshot with a single entity that causes the rest of the world to spawn.
not recommended workflow described below
offline: generate snapshot with an entity that has 1 component delegated to a unity worker.
a) launch deployment from snapshot
b) entity is created and delegates authority to worker.
c) spatialOS launches worker
d) worker creates entity, runs
e) worker spawns the rest of the world
Sounds like I need to really learn spatial 9. I’ve started going through the docs last night.
I finally realized the disconnect I was having was with world setup. In the past everything was so focused on scala in regards to how the entities were created in the world and interacted. I didn’t really understand what you were getting at. I see now how the Pirates github repo @morrison had the PlayerSpawner prefab included in a snapshot so when the snapshot get recreated the PlayerSpawner handles creating entities in the world. I think the main issue was when I opened the ClientScene I didn’t see anything and there was no scala. I’m thinking I need a “OG Spatial Developers Guide to Spatial 9.0”
You guys mentioned you can spawn entities at runtime. How? Could you please provide a link to tutorial or docs?
I only know how to populate at start, but it would be nice to be able to generate entities at runtime and not in the snapshot. Alternatively, could you provide reasons why this would be a very bad idea and I shouldn’t do it?
You can find it here: https://spatialos.improbable.io/docs/reference/9.1-alpha/workers/unity/world-commands
This is not a bad idea, i use it for spawning new weapon pickups for example. Without this feature the world would be really static