Skip to Main Content
Construct 3 suggestions 21H2 - ARCHIVED

This suggestions platform is now closed and will be shut down on March 1st 2024.

Please ensure any content you care about is backed up before that date.

Feature requests are now handled on GitHub here: https://github.com/Scirra/Construct-feature-requests

55 VOTE
Status In development
Categories Editor
Created by skymen
Created on Jul 8, 2021

Prefabs in the editor

Scene graph has introduced a very cool new feature that took a few steps towards prefab (or template/component) objects.

We can now create hierarchies at runtime, and this is great.

There are 2 main caveats however:

1 - If an object type has two hierarchies defined in the project, it is only possible to create one of these two hierarchies, and C3 provides no clear indication which one it will create. Essentially, users need to create one object type per prefab root.

2 - If that hierarchy is to be used multiple times in the project (for level design, for UI work, or for anything else), and if you need to make a change to every hierarchies, you need to go back and change every single one. This one creates a dilemma where either:
- You accept that you'll have to change every single instance of that hierarchy every time you need to make a change, but you get to apply individual changes and visualise them on the layout
- You accept that you cannot change any of these hierarchies individually, and instead place a temporary object that will then be replaced at runtime with the hierarchy.

There is one huge area where this causes issues and it is User Interfaces; Prefabs are very useful to make buttons, windows, dialogs, tooltips, or any common interface element. These elements all share common assets, positioning etc, but very very often need individual changes made like changing the text on a button, changing the animation frame of an icon, etc. They often require even more granularity, by using nested prefabs to create more complex interface elements composed of multiple sub elements.

That specific behavior of prefabs is near to mandatory for proper user interface design, and would be very useful in many other areas of game development.


How it would work:

When a set of objects are selected (in a hierarchy or not), I can decide to make them a prefab. This selection is marked as the template.

Prefabs are listed in the projects view in a separate folder, and I can name them, and reorder them in sub folder.

Double clicking a prefab in the projects bar takes me to the layout where the template prefab has been set up.

Dragging and dropping a prefab from the prefab list on the layout, or copy pasting an existing prefab creates an instance of that prefab.

Changes made to the template also change the instance.

Changes made to the instance do not affect the template, and instead become "property overrides". When the original template makes changes, the instance updates all of its properties accordingly except the properties that are overridden by the instance.
(properties can be anything from adding new objects, deleting existing onces, moving objects in the prefab, or changing individual properties of individual objects)

When an instance has changes compared to its template, you should be able to:
Apply the changes to the template
Revert the changes to the template (ideally, we should be able to have a list of changes that were made and apply/revert them individually)
Create a "prefab variant".

This prefab variant is also listed in the prefabs list like a normal prefab, the only difference is that it's linked to the original template, and so any changes to the first prefab affects that prefab variant (and all subsequent instances of that prefab and its variant)

Another thing to note as well is that prefabs can be nested, just not recursively. As in, a template prefab cannot contain an instance of itself. But a prefab can contain instances of other prefabs.

In runtime, we should be able to create instances of the prefabs listed in the project. Any prefab template gets automatically instantiated at runtime (aka that property inheritance system should only be editor side)

The one thing that is not clearly defined yet, is how the selecting a prefab and managing instance changes would work exactly. I'm guessing it would be in the properties bar, but the specifics of creating, managing and editing prefabs is not entirely clear.

One thing that could be done, is to have prefabs be always wrap selected, and if we want to edit them, they get opened in a special layout view where each individual object that composes that prefab are individually editable. The properties bar could then be used to display prefab settings and individual actions we can take.
If this is done, double clicking a prefab from the project bar would instead take us to that special view.

  • ADMIN RESPONSE
    Mar 15, 2022

    The r286 release introduces a new Templates feature, which allows for parts of this, notably being able to update instances across the project by making them replicas of a template, and choose which template to create at runtime. You can also read more about the feature in the forum thread Templates feature in r286. This does not yet fully cover hierarchies, but work is expected to continue on this to cover hierarchies as well.

  • Attach files
  • skymen
    Reply
    |
    Feb 18, 2022

    @Chris "I would bet money that what they mean is "make it work exactly like Unity"." I'm not though. If I wanted it to work exactly like in Unity I'd say "make it work like in Unity" and not write a 15 paragraph essay on what I want it to do.

    Granted a few of the features I am describing are also features of the prefab system in Unity, but Unity didn't invent prefabs. What I'm proposing differs from Unity's implementation in many ways in order to adjust it as closely as possible to C3's design, which is very different from Unity.

    In fact, just saying "make it work like Unity" is actually counter productive because what you always mean is "in the context of Unity, that feature works great, I want a feature that works just as well in the context of Construct, but also I don't want to have to think about how changing the context will affect the implementation, and I will not tell you any detail about what I personally find great in that feature, nor will I say how it would be great in Construct and what it would solve". That I would bet money on.

  • Chris
    Reply
    |
    Feb 2, 2022

    @Ashley Gullen


    Just for future reference, half of all suggestions are basically "make C3 more like Unity". This suggestion is no different. Which isn't a bad thing, Unity is BY FAR the most popular game engine on the planet right now. So if someone suggests a feature that Unity has, I would bet money that what they mean is "make it work exactly like Unity".

  • Scoremonger
    Reply
    |
    Jan 24, 2022

    This is a frustrating issue with C3 - that it's difficult to maintain instances placed across different layouts, because there is no concept of an authoritative template object that holds default settings for the type. So anytime you make a change to an object type, you have to manually go through all your layouts and update objects by hand.

    This prefab proposal includes the concept of having defaults set in a template object, which is similar to a suggestion I made, but my suggestion was just for object/family variables. @Ashley Gullen, Could/should these be merged? It feels like my suggestion for default object settings is a subset of the features needed to support prefabs, and might be redundant (https://construct3-21h2.ideas.aha.io/ideas/C321H2-I-138)



  • Daniil Elfin
    Reply
    |
    Oct 23, 2021

    The feature sounds absolutely necessary and useful for creating complex UI Designs.

  • dop2000
    Reply
    |
    Aug 11, 2021
    If an object type has two hierarchies defined in the project, it is only possible to create one of these two hierarchies

    Yes, this would be a huge improvement to already great feature.
    I have a system of popup dialogs made with hierarchies in my project, there will be many dozens of them. I wish I could store them all on a separate layout and just create one when needed. It's not possible currently without creating a unique object for each dialog.

  • skymen
    Reply
    |
    Jul 13, 2021

    @Ashley Gullen

    I have made changes to my proposal to explain how it would work exactly, please take a look again

  • skymen
    Reply
    |
    Jul 9, 2021

    I opted against proposing a specific solution, mainly because of C3's peculiar design, and ways of implementing otherwise popular features.
    Most notably, scene graph. It is applied to C3 in a very different way than all other applications of scene graph in the industry, and as such, I did not feel enclined to propose a design that might not be applicable to C3 for some reason or another.

    If you allow me however to only envision a "simplified" version of C3 and not have to cover all potential downfalls, I can try to come up with something and edit my proposal.

  • Admin
    Ashley Gullen
    Reply
    |
    Jul 9, 2021

    This suggestion describes the problem in some detail, but does not appear to actually describe a solution. Since nothing specific is actually being suggested, it is difficult to justify acting on this suggestion, as it's not clear we'll actually be doing what anyone wants. Please see the suggestion guidelines around including a comprehensive description of the suggestion, including detailing precisely how it would look and work.

  • +32
6 VOTE

Add concept of default values per family/object, instance overrides, and reverting

Merged
Most major game engines like Unreal, Game Maker Studio 2, Unity, and Godot support default variable values for each object type, and have the concept of overriding and reverting values on an instance level (screenshots of the variable override UI ...
Scoremonger over 2 years ago in Editor 0 In development