Search Unity

Using ScreenFade script to single out the background?

Discussion in 'Scripting' started by Story Specialist, May 12, 2010.

  1. Story Specialist

    Story Specialist

    Joined:
    Feb 12, 2010
    Posts:
    36
    I couldn't get the answer I wanted on UnityAnswers, so I thought I'd try the forum :). I hope this is okay.

    Basically, my problem is detailed here: http://answers.unity3d.com/questions/9603/how-can-i-individually-fade-the-background-and-not-the-gui

    In short: I want to use the ScreenFade script to fade only a single GUI.DrawTexture, and keep the rest intact.

    The problem is that you can only assign one GUI.depth per GUI function, so either everything fades, or nothing does.

    I think I can solve it by fusing the ScreenFade script into my main script, but I would very much like to keep those two apart.

    One final thing to mention is that that GUI.DrawTexture gets dynamically updated throughout the game (the background texture changes).

    I hope you guys can help me out once more,

    Veli
     
  2. Story Specialist

    Story Specialist

    Joined:
    Feb 12, 2010
    Posts:
    36
    Bump! :)

    If this is not possible, I'd also like to know so I can move on to a different solution, or skip it altogether.
     
  3. dart

    dart

    Joined:
    Jan 9, 2010
    Posts:
    211
  4. Story Specialist

    Story Specialist

    Joined:
    Feb 12, 2010
    Posts:
    36
    Well, yeah, that's the script I'm using :p.
     
  5. Story Specialist

    Story Specialist

    Joined:
    Feb 12, 2010
    Posts:
    36
    One final bump! Someone? Anyone? :)
     
  6. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    The only thing I can think of is to use the GetPixels and SetPixels functions of the Texture2D class to change the alpha values of the pixels in the texture. Not ideal, I know...
     
  7. Story Specialist

    Story Specialist

    Joined:
    Feb 12, 2010
    Posts:
    36
    Ah, okay :). Well, I've decided to do it via another way (crossfade the background with a custom script, rather than use ScreenFade), with which I received help via UnityAnswers.

    Thanks for considering the issue, though :).