Search Unity

Cannot get Unite convert nodes project to work in my own

Discussion in 'Entity Component System' started by calabi, Nov 1, 2019.

  1. calabi

    calabi

    Joined:
    Oct 29, 2009
    Posts:
    232
    I've been trying to figure out how to use the conversion process and blobs and I guess I must be missing something. Its from the below video.



    I've made my own versions of the scripts I've tried transplanting them wholesale into my project, but it seems the blob is not created no matter what. I feel like I'm missing something, like in the NodeConversion script, how is that run am I supposed to manually run the GameObjectConversionSystem somehow.

    And another thing I'm confused how is it able to pass in the NodeAthoring monobehaviour and its links straight into the blob without seeming converting it into an entity.

    I'm using complete gameobjects as the nodes instead of the prefabs would that make a difference?
     
  2. calabi

    calabi

    Joined:
    Oct 29, 2009
    Posts:
    232
    Ok, update I've figured out why it wasn't working but I don't understand why or what is happening. I was only using two scripts NodeAuthoring and NodeConversion

    I tried adding GraphAuthoring to the empty game object that contains all the gameobjects and that makes it work. I'd already removed any mention of GraphAuthoring in the two scripts but still it seems to require that GraphAuthoring exists on the gameobject.

    I think I've sort of figured it out, for some reason it requires that I use this code to create the blob

    Code (CSharp):
    1. Entities.ForEach((GraphAuthoring network) =>
    2.         {        
    3.             DstEntityManager.AddComponentData(GetPrimaryEntity(network), new NodeGraphSpawner
    4.             {
    5.            
    6.                 Graph = nodeGraph,
    7.                 //Prefab = GetPrimaryEntity(network.Prefab),
    8.             });
    9.         });
    I think there is something weird with the way the subscene system works I changed the above to the below to see if it worked, and it did or I thought it did until I rebuilt the entity cache and then it doesn't work.

    Code (CSharp):
    1. var entity = DstEntityManager.CreateEntity();
    2.  
    3. DstEntityManager.AddComponentData(entity, new NodeGraphSpawner
    4.             {
    5.            
    6.                 Graph = nodeGraph,
    7.                 //Prefab = GetPrimaryEntity(network.Prefab),
    8.             });
    So I don't know it seems code changes don't translate through the entity cache, that really threw me off thinking me code was working when it actually was not. I'm guessing GetPrimaryEntity has something to do with why it was not working as well?
     
    Last edited: Nov 2, 2019
  3. siggigg

    siggigg

    Joined:
    Apr 11, 2018
    Posts:
    247
    I think you might be running into the same issue that confused me a couple weeks ago :)

    When using subscenes, the conversion systems only run when you save (ie close) the subscene! It then serializes and saves the results in the subscene asset file, including blob assets.
     
  4. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,685
    If you want to run conversion on every change, just enable livelink in top menu, it will call conversion on every change.
     
    siggigg likes this.
  5. calabi

    calabi

    Joined:
    Oct 29, 2009
    Posts:
    232
    Yeah thanks I eventually realised that. I'm guessing GameObjectConversion system only runs when you close or re-update the entity cache. Could that also be the reason why I cannot create an entity and then assign the blob to it?