How do I add a child sprite to a parent using the child's UID?

1 favourites
  • 2 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • I'm creating a number of sprites that all need to be children of a single parent sprite.

    The "Add Child" function lets me set an *object* as a child, but not the *UID of that object*.

    Is there a way to programmatically set the parent of a child sprite that I'm missing?

    When I create the child sprite, I actually know the UID of the sprite I want to be its parent. But when I "Pick instance with UID" X (where X is the parent sprite's UID), I can't add the child sprite to its parent.

    This is what I have:

    ... which comes during a loop where I'm creating the child sprites. "builtstructures.controllingstructureID" is the UID of the parent sprite.

    Any suggestions?

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you need to create a hierarchy relationship between two instances of the same object, you need to pick each instance separately. The easiest way to do this is with a family - pick one instance of the object and one instance of the family.

    Pick Family with UID=1
    Pick Sprite with UID=2
     Family add child Sprite
    

    Since you already have a family, if it's not possible to pick an individual object, you can create another family (with the same members).

    Pick FamilyA with UID=1
    Pick FamilyB with UID=2
     FamilyA add child FamilyB
    
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)