Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  4. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  5. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Sprite.texture field is not working as i want it to

Discussion in 'Scripting' started by noahthegame, Jul 11, 2018 at 10:54 AM.

  1. noahthegame

    noahthegame

    Joined:
    Jun 8, 2017
    Posts:
    35
    all lays in the following bit of the documentation: "
    Sprite.texture
    Texture2D texture;
    Description
    Get the reference to the used texture. If packed this will point to the atlas, if not packed will point to the source sprite."

    the underlinet "If packed this will point to the atlas" is the problem i want to get the texture of the sprite not its atlas. is there anyway on witch i can do this?
     
  2. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    3,789
  3. noahthegame

    noahthegame

    Joined:
    Jun 8, 2017
    Posts:
    35
    can i cut it out by code?
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    2,481
    Yes, but you might want to consider just turning off packing at that point so you can get at the Texture directly, otherwise you'll be writing a lot of VERY fiddly code that may break or violate assumptions of the Unity texture packer.
     
  5. noahthegame

    noahthegame

    Joined:
    Jun 8, 2017
    Posts:
    35
    so how can i turn off packing?
     
  6. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    2,481
    Google?
     
  7. noahthegame

    noahthegame

    Joined:
    Jun 8, 2017
    Posts:
    35
  8. noahthegame

    noahthegame

    Joined:
    Jun 8, 2017
    Posts:
    35
  9. noahthegame

    noahthegame

    Joined:
    Jun 8, 2017
    Posts:
    35
    my sprites are in an "atlas" becuse they a cut out by the sprite editor (right?) am not sure i understand