Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by androids · Sep 26, 2013 at 06:01 PM · javascriptguiguitexturefade

Fade multiple GuiTextures in ONE Javascript

Hi folks,

Is it possible to fade multiple GuiTextures in and out in only one Js?

If yes, can someone show me how? Because I've no idea how. I'm talking about 3 GuiTextures.

Thanks in advance.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image tw1st3d · Sep 26, 2013 at 06:05 PM 0
Share

Please explain a bit more on what you want to do. You say fade, but, how fast? Which ones at which times? How often?

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Entairex1 · Sep 26, 2013 at 06:29 PM

 var _Alpha : float = 1; // Change this value to change the alpha of the GUI
 var _Texture : Texture2D;
 function OnGUI(){
     GUI.color.a = _Alpha;
     GUI.DrawTexture(Rect(0,0,100,100), _Texture, ScaleMode.StretchToFill, true);
     GUI.DrawTexture(Rect(100,0,100,100), _Texture, ScaleMode.StretchToFill, true);
     GUI.DrawTexture(Rect(200,0,200,200), _Texture, ScaleMode.StretchToFill, true);
 }

Is this what you're looking for?

Hope this helps =)

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image androids · Sep 26, 2013 at 06:36 PM 0
Share

It does nothing and I want the second texture fade in after the first texture fades out and the third texture when the second texture fades out.

avatar image Entairex1 · Sep 26, 2013 at 07:15 PM 1
Share

It's not cool to come here and ask people to create complete scripts for you. How about you try for yourself?

Try using a timer that counts, and if the timer passes an interval, lerp the alpha value

avatar image androids · Sep 26, 2013 at 07:58 PM 0
Share

I'm not asking for someone who can create a Js for me.

I ask for some help. I've written a lot of Js, but without any success.

It works only for one GuiTexture.

Please read my question properly for the next time before you say something :D

avatar image Entairex1 · Sep 26, 2013 at 09:25 PM 2
Share

Here. Drag it onto any component, set the amount of textures you want and go.

 var _bGroundTex : Texture2D[];
 var _ChangeInterval : float;
 var _ChangeSpeed : float;
 private var _tmpTime : float = 0;
 private var _bGroundIndex0 = 0;
 private var _bGroundIndex1 = 1;
 
 function OnGUI(){
     GUI.color.a = 1;
     GUI.DrawTexture(Rect(0,0,200,50), _bGroundTex[_bGroundIndex0], Scale$$anonymous$$ode.StretchToFill, true);
     GUI.color.a = _tmpTime/(_ChangeInterval/_ChangeSpeed);
     GUI.DrawTexture(Rect(0,0,200,50), _bGroundTex[_bGroundIndex1], Scale$$anonymous$$ode.StretchToFill, true);
 }
 function Update(){
     _tmpTime += Time.deltaTime;
     if(_tmpTime >= _ChangeInterval){
         _tmpTime = 0;
         _bGroundIndex0++;
         if(_bGroundIndex0 >= _bGroundTex.Length)
             _bGroundIndex0 = 0;
         _bGroundIndex1 = _bGroundIndex0 + 1;
         if(_bGroundIndex1 >= _bGroundTex.Length)
             _bGroundIndex1 = 0;
     }
 }

JAG ÄR SÅ JÄVLA SNÄLL

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

17 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

WorldToScreenPoint returns the same value when facing the opposite direction. 0 Answers

TouchPads moving when I hit the PLAY button 1 Answer

Setting Scroll View Width GUILayout 1 Answer

How Would I Make A GUI Label Fade After A Certain Amount Of Time? 1 Answer

Fade In GUI on proximity 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges