Search Unity

Hook into prefab import pipeline possible?

Discussion in 'Prefabs' started by phobos2077, Jan 21, 2020.

  1. phobos2077

    phobos2077

    Joined:
    Feb 10, 2018
    Posts:
    350
    I have a bunch of prefabs (using nesting & variants) with a lot of instances on a big scene. I want to somehow post-process the resulting game object (optimize hierarchy), while leaving the source prefabs unchanged.

    From my understanding of how prefabs work, they get imported (in a chain, if nesting/variants is used) just like any normal asset every time there is a change. So I wonder how can I modify/post-process this imported version of the prefab so the optimized version will get inserted into a scene? Is something like this possible at all?

    I can of course make a Scene Post-processor script that will optimize the resulting hierarchy of the entire scene, but that approach is less efficient:

    - It'll have to re-process instances of the same prefabs many times, effectively multiplying the processing required many times
    - Unoptimized versions of prefabs will be loaded when working with this scene in the Editor

    Thanks in advance.
     
  2. thomasa1972

    thomasa1972

    Unity Technologies

    Joined:
    Oct 11, 2016
    Posts:
    10
    It is not currently possible to postprocess the prefab import result. We are actively working on providing this feature, but we don't have an ETA yet.
     
    davidrochin and phobos2077 like this.
  3. BackgroundMover

    BackgroundMover

    Joined:
    May 9, 2015
    Posts:
    224
    For housekeeping purposes, it sounds like this was added in 2020.2
    Prefabs: Added support for a Prefab post-processor.
     
    phobos2077 likes this.