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 /
This question was closed Apr 29, 2015 at 08:56 PM by Bunny83 for the following reason:

Just a "write a script for me" question.

avatar image
-1
Question by Monkey D. Luffy · Apr 16, 2013 at 02:49 PM · spritealphafade out

Create Fading Sprite in C#

I'm trying to create the conditions in which my main character (I call Jinbei) when it hit the shuriken, Jinbei will fade out. After a few milliseconds, Jinbei will fade in. How do I do that? I hope someone can make a script to make it in C#. Thank you

Comment
Add comment · Show 5
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 Graham-Dunnett ♦♦ · Apr 16, 2013 at 02:50 PM 1
Share

This isn't a site to ask for scripts.

avatar image Loius · Apr 16, 2013 at 03:54 PM 0
Share

http://docs.unity3d.com/Documentation/ScriptReference/index.html

Vector3.Distance or OnCollisionEnter or OnTriggerEnter

Renderer.material

StartCoroutine or Time.time

avatar image Monkey D. Luffy · Apr 17, 2013 at 03:22 PM 0
Share

I'm so sorry. I just feel confused to get a solution. I thought here I could just ask a help like a script. Sorry

avatar image deltamish · Apr 18, 2013 at 06:45 AM 0
Share

dnot feel sorry

avatar image Bunny83 · Apr 29, 2015 at 08:55 PM 1
Share

This question should have beed rejected due to our $$anonymous$$oderation Guidelines.

ps: i don't think Luffy would ask such a question. He would send Usopp to figure it out :P

1 Reply

  • Sort: 
avatar image
0
Best Answer

Answer by deltamish · Apr 16, 2013 at 03:37 PM

To create a fading out and in effect try using this script

 //ommitted using unity engine and other
 
 public class Fader : MonoBehaviour
 {
     public GameObject Sprite;///the sprite (most of the time most of the people use plane for sprite)
     public float fadespeed = 2;
     public GUITexture Spriteb;//if u are using this for sprite
     
     void Update()
     {
         //if hit with particles
         if(Sprite)
         {
             Sprite.renderer.material.color.a = Mathf.Lerp(Sprite.renderer.material.color.a,0,Time.deltaTime * fadespeed);
             if(Sprite.renderer.material.color.a==0)
             {
                 FadeIn();
             }
         }
         if(Spriteb)
         {
             Spriteb.color.a = Mathf.Lerp(Spriteb.color.a,0,Time.deltaTime * fadespeed);
             if(Spriteb.color.a ==0)
             {
                 FadeIn();
             }
         }
     }
 
     IEnumerator FadeIn()
     {
         yield WaitForSeconds(2);
         if(Spriteb)
         {
             Spriteb.color.a = Mathf.Lerp(Spriteb.color.a,1,Time.deltaTime * fadespeed);
         }
         //if hit with particles
         if(Sprite)
         {
             Sprite.renderer.material.color.a = Mathf.Lerp(Sprite.renderer.material.color.a,1,Time.deltaTime * fadespeed);
         }
     }
 }
Comment
Add comment · Show 7 · 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 Monkey D. Luffy · Apr 17, 2013 at 03:19 PM 0
Share

hi deltamish, thank you very much. This is very helpful

avatar image deltamish · Apr 18, 2013 at 06:45 AM 0
Share

i am glad the script helped you out

avatar image Osntear · Nov 22, 2014 at 08:20 AM 0
Share

Thanks for your script, so helpful :) So how can I fade back ?

avatar image deltamish · Apr 27, 2015 at 02:47 PM 0
Share

Hi.... @Dusker Studios

Did you just copy the code or rewrite it yourself.. ?

avatar image $$anonymous$$ · Apr 29, 2015 at 08:33 PM 0
Share

never$$anonymous$$d, I fixed it

Show more comments

Follow this Question

Answers Answers and Comments

16 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

Related Questions

Why isn't my script changing the sprite's transparency? 1 Answer

Custom shader of sprite results in black alpha. 0 Answers

Transparency When DistanceProblem 0 Answers

Can a sprite atlas be 4 bit? 0 Answers

Transparency between mesh a cube and a sprite 0 Answers


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