Instances of an array not being populated..

0 favourites
  • 3 posts
From the Asset Store
Easy to use shop and inventroy populated by an array!
  • I have an array which I am instancing and populating with some simple data (a bit of text with the loop index) But when I run this and step through the code with a breakpoint although each instance gets created the data is never added. Not only that but the instance variable ('profile') for each array never gets updated either.

    + System: On start of layout

    + System: For "" from 1 to 4

    + System: Startup_Done = 0

    -> System: Create object Profile_Activity_Array on layer 0 at (0, 0)

    -> Profile_Activity_Array: Set profile to LoopIndex

    -> Profile_Activity_Array: Set value at (1, 1) to "Loop index "&LoopIndex

    Any idea whats going on? I would expect each array instance data to be updated as I step through the loop but everything(profile and loop index string) is 0.

    Cheers

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's probably related to where you have to wait for the next tick because in the current tick the instances are not available yet. So when you create them you have to wait a tick, I think wait 0 seconds works well, try it before the actions.

  • as long as that is all happening inside the loop, the new instance should picked, and I would expect that code to work...

    have you defined the size of the array? can you post a sample file to look at?

    if you are creating array instances to go with something else, another thing you can do is make a "Profile" container object, and put an array object in there - that way the array automatically gets created when you create the Profile object, and it selects the correct one when you select the Profile object.

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