How is the default object instance determined?

0 favourites
  • 7 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • It's really confusing to know which object instance is the default used to create objects at runtime. I've had an object change it's default object instance several times in the lifetime of the project.

    In my mind it would be logical to use the first created instance in the editor as the default. But this doesn't seem to be the case.

    I'd love to know the logic behind this.

  • I've been asking this question for years and have never gotten a solid answer, nor has it somehow ever seemed to be of much importance to other users. It's the first instance of an object you ever make, it's the one in the top-most layout, yes it can be changed, no it cannot be changed, etc.

    It's infuriating when you end up with your "default instance" somehow magically inheriting the properties of some random other instance instead of the first one you created, or whichever you want. This not only becomes the one created at runtime, but the one properties are inherited from when placing a new instance in a layout from the project bar.

    I suggested a "make default instance" button years ago but it never happened.

    All this time and I too still don't fully understand the inner workings of it :')

  • What's interesting is that even now that we don't have to worry about having an instance on a layout somewhere, we still have to have an instance on a layout somewhere... in order to edit its properties.

  • Yeah, I made a thread about it a long time ago. There's no point in glossing over it, the way this is handled in C3 is bad.

    construct.net/en/forum/construct-3/general-discussion-7/object-types-instances-141711

  • I once poked around the C2 source to see where the default instance is pulled from.

    Basically the first layout the object appears, the lowest layer the object appears on that layout, and finally the one with the lowest uid.

    It may be the same in C3, not sure why it would change. The dev’s response indicates they want it to be thought of as arbitrary and could change. It won’t though imo. Most projects rely on the defaults.

    So it seems a good solution would be to create a layout, put one instance of every object, and move that layout to the top of the layout list.

    construct.net/en/forum/construct-3/how-do-i-8/instance-variable-initial-139702

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The default instance is an arbitrary one in the project. Even if this was changed to something more specific like "the first instance placed in the editor", this too can easily change as you edit your project - e.g. imagine cloning the first placed instance a few times, then deleting a couple including the first placed one. Since you just deleted the default instance it will have to choose a different one, so everything changes again. So in general I don't think there's any way to choose a default instance that is immune to changing based on editing your project, which is why it's left as an arbitrary one.

    The intent of the design is either they're all the same, so it doesn't matter, or you set the properties you care about by actions after creating the instance, in which case it doesn't matter what the starting properties were.

  • Alright, good to know that that is the design intent. It's not how I want it to work, but I can see why it was implemented this way. Knowing this I'll be more careful when creating objects at runtime.

    I think the issue is that because at first it didn't seem like the default instance was arbitrary, I had become dependent on the idea that there was '1 true original'. I reckon this is a pitfall many users will stumble into at some point.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)