I actually hate the 'pick instance' events..

0 favourites
  • 5 posts
From the Asset Store
14 amazing sound files of game events like Level Ups, Level Completes, object spawn, object taking etc.
  • <img src="http://i.imgur.com/Niwt6P7.jpg" border="0" />

    This is what should happen:

    Function call "CreatePC" > Set "UID" to expression (FunctionCall return value) (which is the newly created object UID. I have these functions seperated because I want to use CreateUnit_func on a more global scale) > Pick instance with UID "UID" > Do actions to this Unit.UID

    This is what happens:

    Function call "CreatePC" > Set "UID" to expression (FunctionCall return value) > Pick instance with UID "UID" > Nothing happens.

    I suspect its not properly picking the newly created object. I don't see why not.

    CreateUnit_func is working, the object is created, and I also know that the local variable "UID" is getting set its UID. It's just not picking it.

  • Newly created instances are not fully created until the end of the next top-level event. In this case it's not really created until the event calling "CreateUnit_func" finishes. It's a limitation in the engine - you need to make sure all initialisation is done in the event that creates the object.

  • I was suspecting that, but I couldn't quite confirm. Thanks!

  • To Ashley. I know it's part of the limitation of the engine, but it's more frustrating to use. Especially when designing I want to create object linking.

    Currently I do

    create object

    wait 0.02

    uid = object.uid

    this so far works. but feels sloppy :(

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • To Ashley. I know it's part of the limitation of the engine, but it's more frustrating to use. Especially when designing I want to create object linking.

    Currently I do

    create object

    wait 0.02

    uid = object.uid

    this so far works. but feels sloppy :(

    I recall 'wait 0' works as well, it divides it into two sections that are executed one after another. Feels a bit cleaner to me, basically the same thing though :)

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