Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Tiny - positioning instantiated Buttons in a loop problem

Discussion in 'Project Tiny' started by Deleted User, Feb 25, 2019.

  1. Deleted User

    Deleted User

    Guest

    Hi all,

    I hava a problem with instancing buttons one under another.
    This is how I do it:

    EDIT: I simplefied my code. Also add a picture

    Code (JavaScript):
    1.  
    2. for (let index = 0; index < 5; index++) {
    3.  
    4.      let BTEntities = ut.EntityGroup.instantiate(this.world, "game.CollapsedButton");
    5.      this.world.usingComponentData(BTEntities[0],
    6.      [ut.Core2D.TransformLocalPosition,ut.Core2D.TransformLocalScale,
    7.       ut.Core2D.TransformNode, ut.Core2D.Sprite2DRenderer], (p,s, node, sprite) =>
    8. {
    9.         node.parent = panel;
    10.         p.position.y -= (index * 100);
    11.         s.scale.y = (index * 0.5);
    12.         sprite.color = new ut.Core2D.Color(Math.random(), Math.random(), Math.random(), 0.3);
    13. });
    14.  
    15. }
    16.  
    What I do in wrong way?

    Scale is changing, color is changing. Position is not.
    Some bug in TransformLocalPosition for Button?
     

    Attached Files:

    Last edited by a moderator: Mar 1, 2019
  2. Deleted User

    Deleted User

    Guest

    Anyone? Pls.
     
  3. Zoelovezle

    Zoelovezle

    Joined:
    Aug 7, 2015
    Posts:
    54
    Deleted User likes this.