Error: "No default instance when creating object"

Bugs will be moved here once resolved.

Post » Sun Nov 27, 2011 2:34 pm

Hi
I'g getting error when I tried use z as shot.

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(null,"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...")@http://localhost:50000/preview_prelude.js:12
(null,[object Object],false,972,6870)@http://localhost:50000/preview.js:865
([object Object],[object Object],972,6870)@http://localhost:50000/preview.js:858
([object Object],[object Object],3)@http://localhost:50000/Sprite_plugin.js:962
()@http://localhost:50000/eveng.js:711
()@http://localhost:50000/eveng.js:312
()@http://localhost:50000/eveng.js:301
((function (key) {"use strict";var ret = key === this.triggerKey;this.eventRan = this.eventRan || ret;return ret;}),[object Object],[object Object])@http://localhost:50000/eveng.js:1518
((function (key) {"use strict";var ret = key === this.triggerKey;this.eventRan = this.eventRan || ret;return ret;}),[object Object])@http://localhost:50000/eveng.js:1403
([object Object])@http://localhost:50000/Keyboard_plugin.js:85
([object Object])@http://localhost:50000/Keyboard_plugin.js:52
([object Object])@http://localhost:50000/jquery-1.6.3.min.js:3
([object KeyboardEvent])@http://localhost:50000/jquery-1.6.3.min.js:2
B
4
G
2
Posts: 48
Reputation: 1,328

Post » Sun Nov 27, 2011 2:40 pm

The error is pretty much right, we aim to fix this soon but in the mean time just make sure there's an instance of the object you're trying to create already placed in the layout.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Fri Mar 09, 2012 6:55 am

Any update on this one? It's relatively easy to work-around, but I'm finding myself having to work around it a LOT... obviously not something that deserves high priority, but it would be nice to have fixed.
B
24
S
5
G
2
Posts: 104
Reputation: 3,136

Post » Fri Mar 09, 2012 10:30 am

This is actually something that is really anoying if you have a bigger project, its something i would really love to see fixed in next build.

B
28
S
2
Posts: 69
Reputation: 1,491

Post » Fri Mar 09, 2012 7:44 pm

Is it that annoying? You just need one unused layout in the project where you dump a single instance of every object in your game, then you never need to worry about this.

It's kind of a quirk of the engine because if you create an object and there are no instances anywhere in the project, C2 doesn't know what to use for the object properties. It's one of the things on the todo list for a long time but I thought it was minor and it's a little tricky to fix.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Sat Mar 10, 2012 6:04 am

Aha -- I hadn't actually thought to work-around by sticking default instances in a default layout rather than hiding them or putting them off screen. Still a bit of a kludge, but a much nicer fix, thanks!
B
24
S
5
G
2
Posts: 104
Reputation: 3,136

Post » Sat Mar 10, 2012 6:41 am

It should e fairly easy to come up with sensible defaults should't it? The only difficult ones should e position related, and those are supplied during creation.

It is a fairly minor annoyance though -- keep up the great work with other new features, love your work!
B
24
S
5
G
2
Posts: 104
Reputation: 3,136


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest