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 ReflexGames · Sep 21, 2013 at 06:02 AM · guifpsrpgsubtitle

Subtitles in fps game

Hey guys! I'm making a fps games and I want to have subtitles in it. Like player hits a cube trigger, the the guide subtitle gui comes up at the bottom of the screen, with an audio. The after the audio is done, (example-15 seconds) the gui disappears. Please help, I'm still new to unity, and very, very, very very new to coding.

Thanks!

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 Fattie · Sep 21, 2013 at 08:40 AM 2
Share

I strongly recommend using 2DToolkit for "type in Unity".

It's like this ..

1) install 2DToolkit

2) click the "text mesh" button and text appears in your scene

3) move it around, or whatever, like anything else in unity. it's "just that simple".

4) in the code, type more or less "text = "whatever 999"" and the text changes to your new text.

It's the only reasonable way to do score displays, alerts, subtitles -- anything.

It's also utterly essential simply for messages to yourself during development, and so on.

It's really the only way to do type in games in Unity. For many, many popular games now we have converted clients to just using it. It's so, so simple, efficient, etc. You're not trying to ludicrously build mesh around the type edges each time etc. It's just the only way to go.

There's a long comment here ...

http://answers.unity3d.com/questions/384623/setting-font-size-according-to-screen-dpi.html

where I explain precisely how to use "GlyphDesigner" which is the easiest possible way to use any font, whatsoever, in 2DToolkit and hence in Unity.

Couldn't be easier. We tried every possible pipeline before settling on this.

avatar image ReflexGames · Sep 21, 2013 at 06:17 PM 1
Share

i like fattys idea, but i dont want to pay that much. id rather not pay for anything at all. i looked at the links you posted, but its just audio. i really need the subtitles. i researched everywhere but no, i need help.

avatar image clunk47 · Sep 21, 2013 at 06:23 PM 1
Share

The GUI part I posted is your subtitle. You use GUI.Label to show text on screen. In my example, you're checking if the audio is playing or not in order to deter$$anonymous$$e if the GUI Label should show on screen.

avatar image Fattie · Sep 21, 2013 at 07:43 PM 1
Share

For free .. just use the crapp GUI system part of Unity - it works fine!

avatar image clunk47 · Sep 21, 2013 at 07:48 PM 1
Share

I agree w/ Fattie, yeah it can be crappy, especially if you're new at it, but it is the free way lol. I am not sure, but I think NGUI might have a free version...

2 Replies

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

Answer by clunk47 · Sep 21, 2013 at 05:18 PM

A simple solution, check out AudioSource.isPlaying. This isn't a script you can actually use, it's an example of what you would have inside a C# class, because you didn't specify which language you prefer. Break down the example and google each part you don't understand. Also look at the Unity Script Reference that I've linked you to with the information on AudioSource.isPlaying.

 bool showSubs;
 string sub = "This is a subtitle. Audio is Playing.";
 
 void Update()
 {
     if(audio.isPlaying)
         showSubs = true;
     else
         showSubs = false;
 }
 
 void OnGUI()
 {
     if(showSubs)
         GUI.Label(new Rect(0, Screen.height - 64, Screen.width, 64), sub);
 }

Comment
Add comment · Show 1 · 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 ReflexGames · Sep 21, 2013 at 05:21 PM 2
Share

Thanks clunk!

avatar image
0

Answer by YoungDeveloper · Sep 21, 2013 at 06:22 PM

Create new class inside main class, in that class add string, for subtittle text, one float for start time and second for end time. Set everything public. Then create an array of these classes, without setting constant array size. So now you have a dynamic array, and for each element you can set text, start and end time.

Create ongui function, create a text area or whatever and position the area where the subtitle text will be.

Create a variable wich will hold time for subtitles. Something like a = Time.deltaTime.

Then somehow create a little system wich sends string from array element to ongui function to show it on screen depending on elements start and end time. I would need to draw a diagram on paper and think a bit about it, but I'll leave something for you ;).

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

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

Related Questions

Multiple Cars not working 1 Answer

How to display Gui for Ammo and ammo left 0 Answers

Question about fliping a character 1 Answer

Scene Selection 1 Answer

Why doesn't my GUI.Label show up? 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