Creating an object

Discussion and feedback on Construct 2

Post » Sun May 06, 2012 9:37 pm

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?
B
103
S
27
G
15
Posts: 1,150
Reputation: 17,222

Post » Sun May 06, 2012 10:30 pm

Can you tell us the error you got?
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Mon May 07, 2012 1:26 am

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.
B
16
S
4
G
1
Posts: 40
Reputation: 2,705

Post » Mon May 07, 2012 3:33 pm

This is the error message:

[code]<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[/code]
B
103
S
27
G
15
Posts: 1,150
Reputation: 17,222

Post » Mon May 07, 2012 3:38 pm

[QUOTE=glerikud]Assertion failure: No default instance when creating object. You must have at least one instance of every object type in at least one layout.[/QUOTE]

The answer to your question is in your error. You MUST have at least 1 of each object on one of your layouts.
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Mon May 07, 2012 3:44 pm

[QUOTE=Nimtrix]
The answer to your question is in your error. You MUST have at least 1 of each object on one of your layouts.[/QUOTE]

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.
B
103
S
27
G
15
Posts: 1,150
Reputation: 17,222

Post » Mon May 07, 2012 3:53 pm

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.
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Mon May 07, 2012 3:56 pm

[QUOTE=Nimtrix] 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.[/QUOTE]

Thanks for the help. These tips will come handy.
B
103
S
27
G
15
Posts: 1,150
Reputation: 17,222


Return to Construct 2 General

Who is online

Users browsing this forum: Tom and 21 guests