Search Unity

Suggestion: Prefab Variants for any Object (ScriptableObject Variants)

Discussion in 'Prefabs' started by BlaiseRoth, Nov 19, 2018.

  1. BlaiseRoth

    BlaiseRoth

    Joined:
    Oct 11, 2016
    Posts:
    3
    In my game, I have a bunch of settings ScriptableObjects that I use to specify different values for an objects in my game. What I'd like to be able to do is make a new settings object, and only override certain settings, so the rest stay in sync with the original settings object. With prefab variants, this is now possible, but my settings objects need to have an accompanying GameObject, which is not ideal. It makes it clunky to load these settings objects, because I can no longer load them by type, and instead I need to store a reference to them somewhere.

    So what I'd really like is if Prefab Variants were generalised to work on any UnityEngine.Object, so I can make a variant of any asset I like. Mostly I'd use this for ScriptableObjects, but I'm sure there's bound to be other uses for this too.

    Thanks for reading.
     
  2. KazenoZ

    KazenoZ

    Joined:
    Jan 24, 2015
    Posts:
    8
    +1

    Similar use case in my project:
    I made an AI system where I define a behavioural structure of a CP by a collection of traits (Actions they can choose to take), and a few general levers, such as simulated reaction time.

    upload_2019-1-10_9-57-6.png

    I can define different AI difficulty levels or create different behaviours for different game modes by changing the reaction time or values used by each trait to decide whether to choose it at a certain time. But I need to create an asset for each difficulty setting that may very well only differ by a single value being changed (Such as the reaction time), and that means that every time I want to change the basic balance of the core AI, I need to make sure to do it on all difficulty levels separately.

    Would be awesome to have the ability to use variants here.
     
  3. GamerXP

    GamerXP

    Joined:
    Mar 22, 2014
    Posts:
    11
    Same here. I make database using scriptable objects, and I want to be able to make some elements to be variants of others. Using prefabs for such things makes it much more complicated, also that way I can't store whole database as single object anymore. Plus it's still pretty bugged right now and link to prefabs get broken all the time.
     
  4. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    637
    +1

    I've managed to build something like this myself, but it would be incredibly rad if there was a feature like this, since my implementation leaves much to be desired
     
  5. SteenLund

    SteenLund

    Unity Technologies

    Joined:
    Jan 20, 2011
    Posts:
    436
    Hi all,

    Assets variants is something completely different to prefab variants and would require a different implementation in our asset database.

    Prefab variants are basically prefab instances + modifications which is simply nesting at the root of a prefab so variants were simple to do while we were already doing nesting.

    So don't get your hopes too high about asset variants.
     
    Last edited: Feb 12, 2019
    joshcamas likes this.
  6. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    637
    Unsurprising, that makes a lot of sense. :)