Search Unity

What is the best way to convert an array of GameObjects prefab to Entity Prefab

Discussion in 'Entity Component System' started by lijianfeng, Aug 22, 2019.

  1. lijianfeng

    lijianfeng

    Joined:
    Sep 8, 2015
    Posts:
    54
    I use AssetBundle load an array of GameObjects,to convert them to entity prefab,I use the API GameObjectConversionUtility.ConvertGameObjectHierarchy(obj, World.Active),But it seems slowly and can only called on main thread,is there any better way to do this?:(
     
  2. Bas-Smit

    Bas-Smit

    Joined:
    Dec 23, 2012
    Posts:
    274
    have not tried this myself yet, but have you looked at SerializeUtility and SerializeUtilityHybrid?
     
  3. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    You want to look at converting the whole scene that has the references to the prefabs using SubScenes. This way the referenced scene elements as well as the referenced prefabs are going to be fully converted when the game starts and there is no conversion at runtime.
     
    lijianfeng and Antypodish like this.