Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Unity 2018.3 is now released.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Change sprite image in script

Discussion in 'Project Tiny' started by TheFordeD, Jan 28, 2019.

  1. TheFordeD

    TheFordeD

    Joined:
    Jul 9, 2018
    Posts:
    30
    Hi people, and i again need help from you.

    I get index (number of image) from XHR request and i need change current sprite image in current object on index (example: 3).

    I have 9 sprites, how i can load him on game and how i can change this sprites on Sprite renderer object in script

    Necessary changing component in object:
    Screenshot_13.png

    list of sprites in folder:
    Screenshot_14.png
     
    Last edited: Jan 28, 2019
  2. TheFordeD

    TheFordeD

    Joined:
    Jul 9, 2018
    Posts:
    30
    I need load sprite Equals like this code in c# Unity

    Sprite image = Resources.Load<Sprite> (spritesPath + "item_1");
     
  3. TheFordeD

    TheFordeD

    Joined:
    Jul 9, 2018
    Posts:
    30
    How i can do this in Tiny?
     
  4. vincismurf

    vincismurf

    Joined:
    Feb 28, 2013
    Posts:
    118
    1) Add a sprite reference to a Tiny components
    2) Add component to an entity
    3) Store entity in entity group
    4) Instantiate the group
    5) Get the sprite data from the entity
    6) Set the sprite data on another entity