Hello Guest

Author Topic: How to change the alpha of a "Sprite from texture".  (Read 3775 times)

Lrateke

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 8
    • View Profile
How to change the alpha of a "Sprite from texture".
« on: December 07, 2013, 04:17:28 am »
I'm using a whole texture as a background using "Sprite from Texture" for my game and one thing I want to make is change the alpha of the sprite - like darkening it or making it invisible. How can I make that?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: How to change the alpha of a "Sprite from texture".
« Reply #1 on: December 07, 2013, 02:52:55 pm »
After its created, you'll see a sprite component on there. You can adjust the sprite alpha to modify it.

Lrateke

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: How to change the alpha of a "Sprite from texture".
« Reply #2 on: December 07, 2013, 03:14:51 pm »
Well I tried, but I'm not finding. I tried to change the material to some of those that have "Transparency" but all of then darken the sprite, witch is something that I don't wish too. Also I want to change the alpha slowly on an animation, and I can't find a way...

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: How to change the alpha of a "Sprite from texture".
« Reply #3 on: December 07, 2013, 03:19:15 pm »
You can't do it with the unity animation system. It doesn't work with properties.
I recommend using a tween package to do that - HOTween for example, works beautifully.

Lrateke

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: How to change the alpha of a "Sprite from texture".
« Reply #4 on: December 07, 2013, 03:33:45 pm »
Thank you...

I've figured it out - After learning how to make it was pretty easy actually.

DemiGoth

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: How to change the alpha of a "Sprite from texture".
« Reply #5 on: February 26, 2014, 07:38:14 am »
Thank you...

I've figured it out - After learning how to make it was pretty easy actually.

Care to share your solution? I'm in need of some alpha transforming as well ;)

[EDIT]

Found it myself as well -> myObject.color= new Color32(0,0,0,128); // Black & half-transparent Using it to gray-out non essential menu objects....
« Last Edit: February 26, 2014, 07:52:11 am by DemiGoth »