Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Is it possible to swap a script in a prefab variant?

Discussion in 'Prefabs' started by JeffersonTD, Aug 28, 2019.

  1. JeffersonTD

    JeffersonTD

    Joined:
    Feb 5, 2013
    Posts:
    267
    Let's say B and C are subclasses of class A. Is it possible to make a prefab variant that has C in the place of B used by the original prefab?

    I tried this in Editor and even though it's possible to swap the script like it has been somewhat always in Unity, this particular change doesn't get saved in the prefab variant, so once I open the variant again, it still has the original script. I tried to do this by modifying the YAML file manually, but didn't succeed in that either.

    So the question is: is this currently in any way possible? And if not, is there a plan to add support for this?

    I'm using Unity version 2018.4.2.
     
  2. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,877
  3. JeffersonTD

    JeffersonTD

    Joined:
    Feb 5, 2013
    Posts:
    267