Search Unity

Feature Request Presets at runtime

Discussion in 'Scripting' started by Ruchir, Aug 16, 2022.

?

Do you guys think the preset system at runtime would be useful?

  1. Yes

    18 vote(s)
    100.0%
  2. No

    0 vote(s)
    0.0%
  3. I have got my own system to manage states(If so please tell me about it)

    0 vote(s)
    0.0%
  1. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    Is there a way the preset system could be extended to be used at runtime?

    The preset system in short is just way too good. :)

    I haven't been able to get anywhere near the functionality it offers using any kind of method I try (all of them require reflection or new class per component). So it would be really helpful if there was a way you guys could extend the preset system to be usable at runtime.(it's just too good to not be included at runtime :oops:)
     
    joseph114591452 likes this.
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    7,857
    What do you need presets for that Instantiating an object doesn't already provide?
     
  3. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    Well, take a look at this: State System - Opsive
     
  4. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    7,857
    Okay, cool, I guess?

    I don't see how that applied to your problem. It's just a system that developer has built for their tool.

    If you want a copy of something - anything that inherits from UnityEngine.Object - you can Instantiate it.
     
  5. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    Well, I already have a system in place that's better than what you are proposing.

    My point in this thread is to make the preset system available at runtime, it's really good for a lot of use cases including mine.

    One of the major benefits of preset system is that let us selectively include and exclude properties we want to be overridden by a preset (really useful when making a state system which I need btw) and works on all the components without any modification and has much better workflow than saving as prefab.
     
    Alic likes this.
  6. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    7,857
    I can see where you're coming from now.

    Though it's a pretty tall ask for an integral part of the UnityEditor framework to be pulled out and added to the runtime framework. Like most things you're better of implementing it yourself than waiting on Unity to maybe never do it.

    That said the use case you said was more for a temporary override system. The preset system just straight replaces the values that have been set, so not sure how much use that would be.

    The kind of system you've shown could easily be done with scriptable objects in any case.