How do I find the default instance of an object in my project?

0 favourites
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • I've been using Construct for many years, but still don't know the answer to this seemingly simple question - if I have lots of instances of the same object on many layouts, how do I find which instance is the default? I mean the instance which is used as a reference when a new instance is created.

    Tagged:

  • This topic and the one I link to in it are relevant.

    construct.net/en/forum/construct-3/general-discussion-7/default-object-instance-159629

  • Thanks, R0J0hound! I'll use your advice:

    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.

    It still sucks that there's no easy way to find the current default instance. In a big project I often waste a lot of time looking for it.

    Another similar problem is finding the layout where a global layer is defined. Why do I have to open every single layout and check if the layer is overridden there or not?

  • It certainly is a sore point as projects get bigger. Would be nice if the editor could point us to those things but I guess having some dummy layouts to store global layouts and default instances is what we’ll settle with for now.

  • Isn't it IID 0 ?

  • Each layout will have its own instance with IID 0, and it won't necessarily be the default one. I'm talking about locating it in the project.

  • Isnt that what the new template function is for ?

  • Isnt that what the new template function is for ?

    It is, but this feature is more like a workaround than a solution. It's not feasible to set up templates for all objects in the project and it may still be necessary to find the default object instance.

    Besides, templates are only for runtime. The default instance is used as a reference when you create an instance both in runtime and in the editor.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > Isnt that what the new template function is for ?

    It is, but this feature is more like a workaround than a solution. It's not feasible to set up templates for all objects in the project and it may still be necessary to find the default object instance.

    Besides, templates are only for runtime. The default instance is used as a reference when you create an instance both in runtime and in the editor.

    Wouldn't the idea of a objects layout handle that ?

    Create the first object and instance on that/a dedicated layout.

    Later in the editor, if you drag an existing object from the project tree on to the layout, it takes the settings from the object on the objects layout, the first one created.

  • lennaert My question was how to find such instance in a large existing project, which may not have a dedicated layout for storing default instances. And even it does, not all objects may be there. And even if they are, the default instance may change suddenly if you change the order of layouts.

    I was working on a big game last year and there was a very important sprite with lots of instance variables and behaviors, which was used on many layouts.

    I intentionally put the first instance of it on a separate layout and filled in all the default properties. For example, I put these default values: variable isActivated=0, MoveTo Speed=500

    That was working for a while but then broke. Some other instance of this sprite became the default one. So when this sprite was added in layout editor it was created with these values: variable isActivated=1, MoveTo Speed=200 I had to manually edit them and about a dozen other parameters, which was super annoying. And I couldn't find the instance which had become the default one..

  • lennaert My question was how to find such instance in a large existing project, which may not have a dedicated layout for storing default instances. And even it does, not all objects may be there. And even if they are, the default instance may change suddenly if you change the order of layouts.

    I was working on a big game last year and there was a very important sprite with lots of instance variables and behaviors, which was used on many layouts.

    I intentionally put the first instance of it on a separate layout and filled in all the default properties. For example, I put these default values: variable isActivated=0, MoveTo Speed=500

    That was working for a while but then broke. Some other instance of this sprite became the default one. So when this sprite was added in layout editor it was created with these values: variable isActivated=1, MoveTo Speed=200 I had to manually edit them and about a dozen other parameters, which was super annoying. And I couldn't find the instance which had become the default one..

    I don't know if this response helps-- But, if you'd like to use a default main character sprite/character sprite in general, make an Object Bank, and have specific "teleport points" to summon the sprite from the object bank. Therefore, there won't be multiple of the same sprite, and it will always be the default one.

  • > lennaert My question was how to find such instance in a large existing project, which may not have a dedicated layout for storing default instances. And even it does, not all objects may be there. And even if they are, the default instance may change suddenly if you change the order of layouts.

    > I was working on a big game last year and there was a very important sprite with lots of instance variables and behaviors, which was used on many layouts.

    > I intentionally put the first instance of it on a separate layout and filled in all the default properties. For example, I put these default values: variable isActivated=0, MoveTo Speed=500

    > That was working for a while but then broke. Some other instance of this sprite became the default one. So when this sprite was added in layout editor it was created with these values: variable isActivated=1, MoveTo Speed=200 I had to manually edit them and about a dozen other parameters, which was super annoying. And I couldn't find the instance which had become the default one..

    I don't know if this response helps-- But, if you'd like to use a default main character sprite/character sprite in general, make an Object Bank, and have specific "teleport points" to summon the sprite from the object bank. Therefore, there won't be multiple of the same sprite, and it will always be the default one.

    OH SOMEONE ALREADY SAID WHAT I SAID, SORRY- I DIDN'T READ EVERYTHING

  • I simplified things in my explanation. The sprite was actually a family of about 50 sprites. And there were many hundreds of instances of them on layouts, all manually placed in the editor and configured. The game was "find an object and solve puzzles" type, so everything was heavily scripted. Objects behaved differently based on the values in their instance variables.

  • From what I know, there's no built in system to find the original. If-- for whatever reason, you're working on that project now, and looking for the original, you're either going to have to guess, or look for it manually. If each one was configured with a different variable, I'd suggest looking for the one with the lowest of said variable.

  • I simplified things in my explanation. The sprite was actually a family of about 50 sprites. And there were many hundreds of instances of them on layouts, all manually placed in the editor and configured. The game was "find an object and solve puzzles" type, so everything was heavily scripted. Objects behaved differently based on the values in their instance variables.

    Now that's a variable that might be the one throwing things off, Families.

    If you added an "original" somewhere, and decided to add it to a family at a later stage. Then which one becomes the original one for the settings for the things added to the family. Monkey wrench I tell ya.

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