0 Favourites

Object ID

This forum is currently in read-only mode.
  • Is there something that determines what the Object ID is? Using a level editor that places an object based on it's ID works great, however, the number changes as I add objects, but only certain ones. This causes issues in terms of loading objects, as the incorrect objects will not load. Is there a way I can pick the OID? If not, any chance of seeing this as a feature in the near future?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • All object types and all behaviors get their own OID in order from 0 on.

    The order of the object bar kind of shows what the order the OIDs will be a runtime, but no there is no way to set what the OID of an object type will be.

    It's best to avoid using the oid to identify object types in a save file because oids are only guaranteed to be the same for that object type for the duration that the game is run.

    What you can do when you save is ignore what the oid of the object is and use you own numbers:

    ex

    Sprite -> 1

    Sprite2 ->4

    Sprite3 -> 703 ...

    and when you load change from those values to what the OID of the object is:

    if loadedValue == 1

    then oidToUse = Sprite.OID

    if loadedValue == 4

    then oidToUse = Sprite2.OID

    if loadedValue == 703

    then oidToUse = Sprite3.OID

    ...and so on.

  • So essentially build a database that reads the OID reguardless of what it is, not a bad idea. Sure beats the hell out of having a separate set of events that do the same thing.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
167 14,517
DMT2005's avatar
DMT2005
Unread hot topic
123 14,876
Zebbi's avatar
Zebbi
Unread hot topic Locked topic
78 38,335
Ashley's avatar
Ashley Construct Team Founder