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 Conect11 · Sep 10, 2013 at 05:52 PM · fade3d text

Fade in 3d Text

So the other day I asked a question about fading 3d text, and got some awesome feedback that helped me out a lot. Unfortunately, there's one issue that's dogging me now, and am hoping someone might be able to assist me in finding the solution. Here it goes:

You have to climb to the top of a tower. At the highest floor is a boss. Stuff's about to get real. A 3d text appears over said boss' head proclaiming what the boss is, and it's name. You take a step closer, the text fades away, and it's on! ... Well, in a perfect world.

Instead, here's what we see:

It's almost like a billboard...

I've found the way to fade OUT the text when I get close enough, but the text is always there beforehand, like a giant billboard advertising "free boss fight!" for miles around. It can be seen through walls (cubes) trees, you name it. I've tried modifying the script by adding another distance variable, using a wait command to just show the text at minimum distance, then fade it out, etc. And nothing I've tried has worked. Am hoping that someone might be able to see what I'm missing. Thanks, and God bless.

 var fadeIn : boolean;
     var fadeOut : boolean;
     var fadeSpeed : float = 0.01;
     var minAlpha : float = 0.0;
     var maxAlpha : float = 1.0;
     var minDistance = 30;
     var target : Transform;
     var myTransform : Transform;
 
     function Awake()
     {
     myTransform = transform;
 }
 
     function Start()
     {
 
     target = GameObject.FindWithTag("Player").transform;
 
     }
 
     function Update()
     {
 
     if(fadeIn && !fadeOut)
     FadeIn ();
 
     if(fadeOut && !fadeIn)
     FadeOut ();
 
     if(renderer.material.color.a <= minAlpha)
     {
     fadeOut = false;
     if(Vector3.Distance(myTransform.position, target.position) > minDistance)
     {
     fadeIn = true;
     }
     }
 
     if(renderer.material.color.a >= maxAlpha)
     {
     fadeIn = false;
     if(Vector3.Distance(myTransform.position, target.position) < minDistance)
     {
     fadeOut = true;
     }
     }
     }
 
     function FadeIn()
     {
     renderer.material.color.a += fadeSpeed;
     }
 
     function FadeOut()
     {
     renderer.material.color.a -= fadeSpeed;
     }




Comment
Add comment
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

2 Replies

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

Answer by Griffo · Sep 10, 2013 at 05:59 PM

Try this .. http://wiki.unity3d.com/index.php?title=3DText

Comment
Add comment · Show 2 · 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 Conect11 · Sep 10, 2013 at 06:07 PM 0
Share

Thanks Griffo, that did the trick. You are awesome!

avatar image Griffo · Sep 10, 2013 at 07:58 PM 0
Share

Glad to help ..

avatar image
0

Answer by citizen_rafiq · Sep 10, 2013 at 06:14 PM

public class HealthFlash : MonoBehaviour {

 private float _speedInc=2.0f;
 private float _colorCom;
 private bool _pingPong;
 private float _weightFlash=0;
 private float _speed;
 private bool _enaHealthFlash;
 void OnEnable(){
 _colorCom=1.0f;
 _pingPong=true;
 _weightFlash=0.0f;
 _speed=_speedInc;
 _enaHealthFlash=false;
 renderer.material.color=new Color(1,1,1,1);
 }
  
 void Update(){
 if(_enaHealthFlash){
 BossHealthFlash();
 }
 }
 public void OnHealthFlashSpeedInc(){
 _enaHealthFlash=true;
 _speed +=_speedInc;
 }
 public void DisableHealthFlash(){
 _enaHealthFlash=false;
 }
 private void BossHealthFlash(){
 _weightFlash +=Time.deltaTime*_speed;
 if(_pingPong){
 _colorCom=Mathf.Lerp(0,1,_weightFlash);
 if(_colorCom==1){
 _weightFlash=0;
 _pingPong=false;
 }
 }
 if(!_pingPong){
 _colorCom=Mathf.Lerp(1,0,_weightFlash);
 if(_colorCom==0){
 _weightFlash=0;
 _pingPong=true;
 }
 }
 renderer.material.color=new Color(_colorCom, 1,_colorCom, renderer.material.color.a);
  
 }

}

Comment
Add comment · 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

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

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

Fading 3D Text 1 Answer

Fading out GUITexture - I need help with timer function that will control the speed of fading out 1 Answer

Attempting to fade 3d text 1 Answer

Fading 3d text - only fades once 1 Answer

Fade 3d text with lerp? 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