Creating an object

0 favourites
  • 8 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • I have a question about using the System's "Create object" action:

    When I use this action I always get a long list of error in the browser (already tried multiple ones). Unless I add an unneccessary copy of the object to one of the layers, the error appears.

    What is causing it? Can you help me solve it?

  • Can you tell us the error you got?

  • It sounds like the message that begins "Assertion failure. No default instance when creating object." There is a lengthy stack trace. But the basic message also says, "This will be fixed in a future build." So I figured it is on the to-do list. Not hard to work around.

  • This is the error message:

    <localhost>
    
    Assertion failure: No default instance when creating object.  You must have at least one instance of every object type in at least one layout.  This will be fixed in a future build...
    
    Stack trace: 
    assert2([arguments not available])@http://localhost:50000/preview_prelude.js:12
    <anonymous function: runtimeProto.createInstanceFromInit>([arguments not available])@http://localhost:50000/preview.js:1191
    <anonymous function: runtimeProto.createInstance>([arguments not available])@http://localhost:50000/preview.js:1184
    <anonymous function: sysacts.CreateObject>([arguments not available])@http://localhost:50000/system.js:537
    <anonymous function: actionProto.run_system>([arguments not available])@http://localhost:50000/eveng.js:931
    <anonymous function: eventblockProto.run_actions_and_subevents>([arguments not available])@http://localhost:50000/eveng.js:499
    <anonymous function: eventblockProto.run>([arguments not available])@http://localhost:50000/eveng.js:474
    <anonymous function: runtimeProto.triggerOnSheetForTypeName>([arguments not available])@http://localhost:50000/eveng.js:1893
    <anonymous function: runtimeProto.triggerOnSheet>([arguments not available])@http://localhost:50000/eveng.js:1785
    <anonymous function: runtimeProto.trigger>([arguments not available])@http://localhost:50000/eveng.js:1749
    
    Error created at assert2([arguments not available])@http://localhost:50000/preview_prelude.js:12
    <anonymous function: runtimeProto.createInstanceFromInit>([arguments not available])@http://localhost:50000/preview.js:1191
    <anonymous function: runtimeProto.createInstance>([arguments not available])@http://localhost:50000/preview.js:1184
    <anonymous function: sysacts.CreateObject>([arguments not available])@http://localhost:50000/system.js:537
    <anonymous function: actionProto.run_system>([arguments not available])@http://localhost:50000/eveng.js:931
    <anonymous function: eventblockProto.run_actions_and_subevents>([arguments not available])@http://localhost:50000/eveng.js:499
    <anonymous function: eventblockProto.run>([arguments not available])@http://localhost:50000/eveng.js:474
    <anonymous function: runtimeProto.triggerOnSheetForTypeName>([arguments not available])@http://localhost:50000/eveng.js:1893
    <anonymous function: runtimeProto.triggerOnSheet>([arguments not available])@http://localhost:50000/eveng.js:1785
    <anonymous function: runtimeProto.trigger>([arguments not available])@http://localhost:50000/eveng.js:1749
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Assertion failure: No default instance when creating object. You must have at least one instance of every object type in at least one layout.

    The answer to your question is in your error. You MUST have at least 1 of each object on one of your layouts.

  • The answer to your question is in your error. You MUST have at least 1 of each object on one of your layouts.

    Yes, I already figured it out, but that means that I usually have to add an unnecessary copy of the object to a layer where it can't be seen.

    What I want is to have the objects stored in the project and only create them when they are necessary.

  • What you are looking to do is currently not possible in C2.

    I guess you could make a new layout containing one of every object, but I find it easier to just keep the "unnecessary copy" outside the layout, sometimes with the "destroy outside layout" behaviour.

  • What you are looking to do is currently not possible in C2.

    I guess you could make a new layout containing one of every object, but I find it easier to just keep the "unnecessary copy" outside the layout, sometimes with the "destroy outside layout" behaviour.

    Thanks for the help. These tips will come handy.

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