- Home /
How to add a subtitle to my game
Hi guys! please teach me on how to add a subtitle to my first person game that will appear when a voice audio is played. Thank you
Actually im stuck at the very beginning on putting a subtitle. Im trying to use text mesh and when an audio file is played, the text mesh will setActive, but im wondering if theres a better way to make a subtitle to put inside the game.
Answer by Digital-Phantom · Mar 22, 2015 at 11:19 AM
Probably the easiest way is just create your subtitle in something Paint / Photoshop.
Drag that image into unity as a texture.
Make a plane, add the texture to it.
Add a sound source to the plane object, attach your speech audio file.
Then simply instantiate the plane in front of your main camera/player and you are good to go.
Then just destroy the object once the audio has finished.
(repeat this as many times as you need with as many subtitles as you like)
:)
Answer by DiegoSLTS · Mar 22, 2015 at 12:14 PM
I'd do it using the UI features of Unity instead of a Text mesh, you have more control over the text's shape and position.
But I guess you're in the right direction, I can't think of anything simpler than displaying a Text game object when an audio clip is played.
You probably need some script that handles all the audio clips and the subtitles to display and hide the text when the audio starts or stops. You probably also need to synchronize more than one subtitle for one clip if the audio is long. Each subtitle for an audio clip could have it's length.
The idea of making the subtitles as a texture looks really bad, you'll need a texture for each subtitle. Using a Text component you only need the text for each subtitule, and set the current one as the Text component's text.
Your answer
![](https://koobas.hobune.stream/wayback/20220613190816im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Play Audio from different Object 1 Answer
Using PlayerPrefs to save settings menu 2 Answers
How can I speed up getSpectrumData for visualization of audio on mobile? 1 Answer
FPS audio problem 1 Answer
How Would I Create An (FPS RPG)? 1 Answer