After upgrading to Entities 0.2.0, I can’t get things running anymore. I use procedural generation in MonoBehaviour, which accesses the EntityManager, creating entities at the start of runtime. At some stage I’ll be updating the MonoBehaviour procedural code to a system, but still want to move forward with this setup for now.
Previously I was accessing the EntityManager with World.Active.EntityManager. When replacing this with World.DefaultGameObjectInjectionWorld.EntityManager, I get a message saying that no World is created yet. Looking at the script execution order, I see that the DefaultWorldInitializationProxy runs after all other scripts (and reverts to that position when trying to move it). When I try and run DefaultWorldInitialization.Initialize(“Default World”, false) to create a world prior to running the MonoBehaviours, it freezes.
So from now on, you are responsible for initializing a default world and setting up World.DefaultGameObjectInjectionWorld in your CustomBootstrap.
For example, from the release log:
class MyCustomBootStrap : ICustomBootstrap
{
public bool Initialize(string defaultWorldName)
{
Debug.Log("Executing bootstrap");
var world = new World("Custom world");
World.DefaultGameObjectInjectionWorld = world;
var systems = DefaultWorldInitialization.GetAllSystems(WorldSystemFilterFlags.Default);
DefaultWorldInitialization.AddSystemsToRootLevelSystemGroups(world, systems);
ScriptBehaviourUpdateOrder.UpdatePlayerLoop(world);
return true;
}
}
Thanks @Singtaa ! Still can’t get things running, but the debugger doesn’t even reach this, so it must be something else that happened during the upgrade. Will keep looking.
I call it in the Start function, then that entityManager variable is used later on in the script. Now I can’t even launch the project in the editor, it crashes during the Unity splash screen. Will uninstall and start again…
Tried reinstalling packages, deleting library folder and different Unity versions but couldn’t get 0.2.0 working. Now just upgraded to 0.3.0 and it’s all working again finally