Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 SevenK · Jul 17, 2015 at 12:49 PM · textfading

How to create fading (In and Out) GUI text in Unity 5

Hi! I am currently working on a project and ran into a problem that regards a function I need throughout the game. I was looking for a sort of GUI Text that pops up throughout the game, mostly for dialogue or natural message purposes (In game screenshot below)alt text but I currently couldn't find any solutions on the forums. Most of them require a box collider with a trigger which is understandable, but never seems to work on my character. Also many other tutorials don't come to much help as they are outdated and don't work properly on Unity 5. If there is a simpler solution for pop up GUI text in unity 5, id be very thankful if I could get some help. If you can help, here is a reference to what I am trying to recreate on my character.. https://youtu.be/ikrJqlBr1gI?t=6m36s alt text(Basically the text that fades in and out when the protagonist speaks as well as the messages that guide the player on what to do or where to go) Many thanks :)

yeahhhh.jpg (60.0 kB)
yeahhhhhhhh.jpg (55.7 kB)
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 meat5000 ♦ · Jul 17, 2015 at 09:49 AM 1
Share

Cant you just adjust the Alpha value of the colour of the UI Text-Box?

4 Replies

· Add your reply
  • Sort: 
avatar image
4

Answer by KdRWaylander · Jul 17, 2015 at 03:00 PM

Hi,

You can use animations (and an animator) to modify the alpha of your text.

Or add a canvas group component and modify its alpha value (and all the objects you add to this group will fade the same way)

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
avatar image
1

Answer by Positive7 · Jul 17, 2015 at 03:43 PM

http://wiki.unity3d.com/index.php/Fade

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 staraffinity · Feb 09, 2016 at 10:01 PM 0
Share

Could you perhaps give an example to where those example code snipets you linked to should be placed in a Unity C# script? I get parsing errors… :(

avatar image caden-burleson · Feb 10, 2017 at 03:14 AM 0
Share

Where are you finding the alpha on a canvas? I'm trying to fade multiple images on/off over a short time say 0.2sec to 0.5sec with the click of a button, but neither my images or canvas have any sort of alpha option...

avatar image
0

Answer by Nick_Rizzo · Feb 10, 2016 at 02:54 PM

This is very simple all you have to do is add the canvas group component to the text, then you will add the ANIMATION (Not animator unless you want to) component to the object, then create an animation and change the alpha to zero or what ever number you want at about 2 seconds in or however long you want it to fade for. You can then create a script like this and put it on the gameObject. "For c# just change function to void"

 function OnTriggerEnter ()
 {
 gameObject.GetComponent.<Animation>().Play("name of animation");
 }
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
avatar image
0

Answer by Jjules · Feb 10, 2017 at 03:39 AM

This is actually very simple! Just make a canvas group, get a local reference to it (using UnityEngine.UI, public CanvasGroup cg, maybe cg = GetComponent< CanvasGroup>()), and SmoothDamp the alpha of the CanvasGroup (cg.alpha = Mathf.Smoothdamp(cg.alpha, 1 to fade in/0 to fade out, ref referenceVariable, fadeTime)

Comment
Add comment · Show 3 · 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 caden-burleson · Feb 10, 2017 at 04:23 AM 0
Share

Thanks! I really wish they would have made all the UI elements have an Alpha ins$$anonymous$$d of just specific ones... Didn't realize CanvasGroup would have an alpha and not the normal canvas or image UI.

avatar image caden-burleson · Feb 10, 2017 at 04:42 AM 0
Share

What does the reference variable thing do?

avatar image Jjules caden-burleson · Feb 10, 2017 at 02:44 PM 0
Share

No problem! SmoothDamp needs a variable it can play with to do the smoothing calculations. Its the equivalent of giving you a sheet of scratch paper to solve a math equation. The reference variable is the SmoothDamp's scratch paper. Just make a variable, do absolutely nothing to it, and feed in ref [variableName] in SmoothDamp so it can mess with it is all

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

9 People are following this question.

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

Related Questions

How can I start fading out text upon setting it? 3 Answers

Fading a text gui style 3 Answers

Having proper text areas in unity? 0 Answers

I cant read the file i wrote, unless i reload it in VS. 1 Answer

Can TextMesh support multiline text? 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