How do I pick by instance variable ?

Not favoritedFavorited Favorited 0 favourites
  • 3 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Hi,

    I'm having trouble creating or updating an object in Construct 3 depending on whether an instance with a specific variable already exists.

    What I’m trying to do:

    On signal received:

    Pick the player_hitbox object using its instance variable myId

    If it does not exist, create a new one

    If it does exist, update its position

    Unfortunately, I can't get this to work. Right now, the event always ends up creating a new player_hitbox, even though one with the same uniqueId already exists.

    Here’s a screenshot of my event sheet for reference:

    Any idea what I'm doing wrong? Thanks in advance!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • At a glance, it looks like you're checking an instance variable uniqueId of player_hitbox, but setting a different instance variable playerUID.

    If that isn't the problem, I would suggest outputting all of the variables you're comparing to see why they may not be lining up.

  • Hello,

    You know what? Taking breaks is really important... Even Construct 3 gives us a gentle reminder every two hours!

    Thanks for pointing out the confusion 😊

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