Search Unity

Idea for prefab varients (value modifiers). Not sure how feasable this is...

Discussion in 'Prefabs' started by IllTemperedTunas, Sep 20, 2018.

  1. IllTemperedTunas

    IllTemperedTunas

    Joined:
    Aug 31, 2012
    Posts:
    782
    Lets say we have a goblin, and we want a "strong goblin" prefab variant that has 1.5x health of the original goblin...

    Currently you can override the original value of the goblins health by putting in a value of 15 instead of 10. But it would be awesome if you could put "150%" and it would automatically detect the original prefabs value and modify it by 150% to give you a properly boosted value. This way if we were to modify the original goblin to have 20 HP, the "strong goblin" would auto update to have 30 HP, rather than simply overriding 20 with 15 hp and actually being a weaker goblin.

    Just a random thought. Obviously we could set up a secondary value on goblins "health modifier" that we could customize goblin to goblin, but the above method would be an awesome catch all that would greatly reduce bloat in tuning secondary unit types in all kinds of ways.

    This would be unique functionality to work strictly with float values.
     
    Last edited: Sep 20, 2018
    Deeeds likes this.
  2. Deeeds

    Deeeds

    Joined:
    Mar 15, 2018
    Posts:
    739
    Kind of like how the scale value works with curves!

    A very good idea!!!
     
  3. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    1,188
    Good idea, but a very specific one, which Unity is not likely to consider. It would be very easy to add a second field as a multiplier or wrap all of your floats into a catch all solution, like Shell Games do with their ScriptableObject architecture (FloatVariable, FloatReference, etc.). I would take a look at that project and maybe adapt your own ValueModifier class which wraps a float and has an optional dropdown to specify a multiplier for another value, which can either be some reference to another component, ScriptableObject or potentially the value provided by the base/variant prefab.
     
  4. Deeeds

    Deeeds

    Joined:
    Mar 15, 2018
    Posts:
    739
    It's not quite as specific as it first appears.

    In Particles, for example, almost all settings are able to be subject to a scalar/multiplier, which provides a lightning fast way to scale things dynamically.

    This near universality is because most settings in Particles can be curves, and multipliers are things that influence the curves, which then, in turn, influence their field/property.

    Taking this idea to heart (the multiplier concept), providing a universal multiplier to all simple value based fields (ints, floats, doubles) in prefabs offers ENORMOUS power for a relatively simple and easy to describe feature, that doesn't taint or otherwise pollute the underlying prefabs.

    It's a true gem of an idea!
     
    IllTemperedTunas likes this.