v0.2.0 GameObjectConversionSettings(World)' is obsolete

Previously from monobehaviour I had:

Entity projectilePrefabEntity = GameObjectConversionUtility.ConvertGameObjectHierarchy(prefab.gameObject, World.Active);

But now I get:

warning CS0618: 'GameObjectConversionSettings.implicit operator GameObjectConversionSettings(World)' is obsolete: 'GameObjectConversionSettings.implicit operator(World) is deprecated, use GameObjectConversionSettings.FromWorld() instead.

Is there any samples that explain this new coding method with how to derive params for FromWorld()?

Seems like you can still use the default (active??) world and pass in null as the second param. Not sure what’s really happening here but for anyone else, here is an example.

https://github.com/Unity-Technologies/EntityComponentSystemSamples/blob/master/ECSSamples/Assets/HelloCube/4.%20SpawnFromMonoBehaviour/Spawner_FromMonoBehaviour.cs

1 Like

If you check the linked source:

var settings = GameObjectConversionSettings.FromWorld(World.DefaultGameObjectInjectionWorld, null);
var prefab = GameObjectConversionUtility.ConvertGameObjectHierarchy(Prefab, settings);

this is how you do it now

2 Likes