UIDs into Arrays

0 favourites
  • 3 posts
From the Asset Store
Act on your instances, get/set their properties and variables only thanks to their UID. No more picking trouble! Plugin
  • Arrays are killing me. How do I get the UIDs of 4 instances of one object into 4 slots in an array?

    I created an object, dragged 4 instances of it to the Layout. Then I created an array on the layout and get it dimensions of 4,1,1.

    On the event sheet I tried:

    Array>For Each element on the event

    Array>Set Value at Arrayname.At(loopindex) to objectname.UID on the action

    It doesn't seem to work and I can't figure out where it's messed up. Can anyone help explain this concept? Once the UIDs are in the array, I think I know how to use the array with For Each statemes.

    Thank you in advance for any help

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • put the capx it will help us to know the problem , about arrays they sets variable as x,y and they can store many value

    put a variable in the object

  • your goin about it backwards. You dont loop thru the array to assign the UIDs you loop thru the objects to assign the UIDs

    theres no loopindex for "for each" so make a local var and in the for each add 1 to it AFTER you assign the UID to the array.

    for each "object" -> Set Value At "count var" to object.UID

    Add 1 to "count var".

    Now your array will contain the UIDs. You can also dynamically size the array to the number of objects but it has to be done before you start assigning values to the array

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