Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Changing the source image of a sprite sheet during runtime

Discussion in '2D' started by Aegilluum, Oct 19, 2014.

  1. Aegilluum

    Aegilluum

    Joined:
    Sep 28, 2013
    Posts:
    28
    Hi,

    Is there a way to load a different image source of a specific sprite sheet during runtime ??


    Thank you
     
  2. cbothra

    cbothra

    Joined:
    Mar 14, 2014
    Posts:
    125
  3. Aegilluum

    Aegilluum

    Joined:
    Sep 28, 2013
    Posts:
    28
    thx for your reply !

    I tried : renderer.material.mainTexture = Resources.Load.<Texture2D>("playerSheet2.png");

    But doesn't work. What i want to achieve ( don't know if my question was clear) is not to change a texture on an object. It's to change to image source which contains multiple sprites for my animations.
     
    Last edited: Oct 20, 2014