Failed to find pin object by UID when loading from JSON.

0 favourites
  • 11 posts
From the Asset Store
Wall Pin Board is a hyper causal game developed for fun and inspired by YouTube video whose link is given in description
  • This is the error I'm receiving.

    This error occurs when the game attempts to "load" a screen.

    My game is saving each object's JSON data to a key=value array.

    Upon loading, it loops through this array, and for each object of type A, creates object A and loads A from JSON at Array.CurX,1 (where CurX,1 is the JSON data of the object that was saved.)

    I had assumed that the pin properties would be correctly saved and recalled by saving the object AsJSON and loading it back from that data. Either this is the incorrect method or I'm just doing something wrong.

    Any suggestions?

  • objects created dynamically are not guaranteed to have the same UID.

    Since your creating the object through a loop any object created at any time can offset that. It's unreliable to rely on the same UID. I suggest reading on UID and IID. UID are id value that is the same pool of id's as all objects.

    So the pin properties are probaly fine. But there was a mistaken use of applying the data.

    If you can share a snippet of the work that focuses on this error(no third party plugins please). Then we can take a look and find an alternative.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sure, I'll post that up this evening.

    The reason the UID error is strange is because I'm not actually pinning based on UID in my events. I'm pinning based on creation and overlap... so when object A is created, create object B and pin it to object A at X image point.

    Thanks for the reply!

  • Okay, here is where the object is being created and pinned to the other object:

    And here is where it's being loaded... this is when the error occurs:

  • Those images are broken for me.

  • Tried to change the links hopefully that'll work. Did them the same way as the one in the OP.

  • hmm. could you link a minimal capx, I think I need a larger picture of what's going on.

  • Sure.

    I've attached it to this post.

    You'll find the "problem areas" under the Sector Gen Group -> LoadSector function (this is actually the function that is causing the error, when it tries to load the pinned object)

    The pinned object is created under Enemy AI Group -> NME Ship

    I stripped out everything that wouldn't prevent enough function to replicate the error.

    To see the error, simply go off any edge of the screen, then go back to the last screen, then return to the one you just visited. When it tries to load a screen with an enemy ship+turret is when the error occurs.

  • Sorry the link was broken. Didn't realize until later in the day.

    I've attached the capx to the prior post.

  • I've managed to overcome the issue by introducing a "wait for signal" in the event that loads the turrets. This works with or without an actual signal, so it appears that the timing is an issue. By delaying the loading of the JSON data for the turret just a small amount it is able to find and pin to the proper object.

  • ug. I forgot about this thread. Sorry. Glad you found the problem.

    You found one of the quirks of C2. Objects aren't always ready once created. It's overlooked often, but it's one these issues that crops up every so often.


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