Search Unity

How to find bounding rectangles for sprites in a texture at runtime?

Discussion in 'Scripting' started by diccuric, Sep 9, 2017.

  1. diccuric

    diccuric

    Joined:
    Jan 23, 2015
    Posts:
    7
    How to find bounding rectangles for sprites in a texture at runtime?
     
  2. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,261
  3. diccuric

    diccuric

    Joined:
    Jan 23, 2015
    Posts:
    7
    Chris-Trueman, the texture is loaded from the file system at runtime
     
  4. fire7side

    fire7side

    Joined:
    Oct 15, 2012
    Posts:
    1,819
  5. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,261
    Then you will need to define it yourself. If its a sprite sheet you may want to have some data about that sprite sheet loaded as well when the texture is loaded, so you can use that data to create the sprites.
     
  6. diccuric

    diccuric

    Joined:
    Jan 23, 2015
    Posts:
    7
    how to does it Sprite Editor in Automatic slice mode? are there any sources or libraries?
     
  7. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,261
    Its built into the editor. You would have to take a look and see what you can find for it.