Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Subscenes & Hybrid Behaviours

Discussion in 'Entity Component System' started by bpeake, Sep 29, 2020.

  1. bpeake

    bpeake

    Joined:
    Apr 8, 2013
    Posts:
    22
    I'm trying out creating entities through the sub-scene approach rather than the convert-from entity. I have a monobehaviour I wanted to inject in hybrid mode like i did previously, however it seems like this functionality is not supported in the sub scene approach? Am I missing something?
     
  2. Lieene-Guo

    Lieene-Guo

    Joined:
    Aug 20, 2013
    Posts:
    547
    Try this one.It's not injected. But could be better than Injected.;)
    the key is
    conversionSystem.AddHybridComponent(comp);


    You may need to remove [NaughtyAttributes.ReorderableList] and the
    if (comp is SkinnedMeshRenderer){...}
    those parts need some other referenced source
     

    Attached Files:

    Last edited: Sep 29, 2020
  3. bpeake

    bpeake

    Joined:
    Apr 8, 2013
    Posts:
    22
    Tried that out and the system can now see the hybrid component. However the script I have has references to other unity objects that are stored as either children or just other monobehaviours on the same gameobject. These are now coming up null. Is there any way to keep these references?
     
  4. Lieene-Guo

    Lieene-Guo

    Joined:
    Aug 20, 2013
    Posts:
    547
    Try this one
    I don't think so. I'm doing that all manually...
    You can convert all child to entities. and use GetPrimeryEntity to link them.
    Hybrid component is designed in favor of ECS instead of Go/Mono.