How do I get UID of Spawned Object?

0 favourites
  • 6 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
  • How do I get UID of Spawned Object?

    I want to set instance values to the object that spawned by itself.

    If you know a better solution let me know

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What do you mean by "spawned by itself"?

    If you have sprite A which spawns sprite B, you don't need to know B.UID, you can simply do this:

    A spawn B

    B set instance variable ....

  • What I mean is Sprite A spawn Sprite A

  • You can try a trick with a family.

    Create a family with sprite A.

    Then use "FamilyA spawn A"

    "A.UID" in this event will refer to UID of a newly spawned instance.

    Or you can use "System->Create" action:

    Function call "CreateNewA" (A.x, A.y)
    
    On function "CreateNewA" 
       System-> create new A on layer 0 at (function.param(0), function.param(1))
       A set instance variable ....
    [/code:1kr5a5k7]
  • Why not just do a simple "on created --> set bla bla bla to object.uid"

    Doesn't get any easier than that.

  • Why not just do a simple "on created --> set bla bla bla to object.uid"

    Doesn't get any easier than that.

    I didnt know that condition exist till you point that out thanks alot

    You can try a trick with a family.

    Create a family with sprite A.

    Then use "FamilyA spawn A"

    "A.UID" in this event will refer to UID of a newly spawned instance.

    Or you can use "System->Create" action:

    > Function call "CreateNewA" (A.x, A.y)
    
    On function "CreateNewA" 
       System-> create new A on layer 0 at (function.param(0), function.param(1))
       A set instance variable ....
    [/code:18mvpv1v]
    

    thanks for the answer it helps a lot

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