I've been having the usual problem of not being able to use objects which have just been created which are on the same 'level' as the next groups of code. As such, I've had to move the function to create my objects to a higher level, so that the next group of code is in the level lower. But now the strangest thing is happening.....

I create my objects in a function (which is at an even higher level and I can confirm that the objects are created) but in the very next line of code, when I do an object.count, it's back to zero.

I've always had this problem with C2 and the solution is usually to check that the objects are created on a higher level, but it seems to have changed.

Unfortunately not because it's huge and won't work without the access to my database. I've had no choice but to make the objects permanent from the start of the game instead of creating them just for a certain screen (and then deleting them later). It's working now, but I'm not sure what was causing that problem before.

Sprite.Count will return 0 if there are no existing Sprites. You can't call an expression (.Count) on a Sprite object if there aren't any Sprite objects. It would be like using Sprite.X or Sprite.Width when no Sprites exist. It would just return 0.

So after the function call where the objects don't exist yet, then there is no object to call object.count on. But if you had at least 1 object already on the layout then it would work.

But surely if the function creates the sprites, then immediately after returning from the function, sprite.count should show 10 (I made 10). Or is your point that the objects don't actually 'exist' at that point? If so, when do they begin to exist?

I should say that I'm happy with having these as permanent objects anyway really, I can just keep them offscreen when they're not needed. But it'd still be interesting to know what happened.

I had this same problem when using the save \ load features. Objects would exist but would disappear after a load and just act strange. Can you attribute the disappearances with occurring after a "load" Switching to Webstorage fixed it for me.I didn't do a bug report either due to project size.

I'm fairly sure in my case it was because I was trying to use them in the same event after creating them from a function. Although they still wouldn't work in sub-events. But when I set up the same structure in a few project, it did work, so something must've been wrong with my code somewhere.