Adorable speech bubbles on your head, ladies and gentlemen
Optimized for mobile specifically
Show npc name instead if not talking at the moment using Print() instead of Say()
function NamePrinter()
{
while(1){
if(!isTalking !speech.isPrinting !speech.object.active !hideName)
speech.Print("Morris\n< Squire >");
yield WaitForSeconds (1);
}
}
While working on multiplayer, I felt a need to show red colored name for enemies since character is so small one can’t make out weather it is ally or enemy.
This was the moment I regreted having cubes as characters.
Anyway, this is how you can use another material for red names.
-
Copy the original 3d text material and give it the same font texture then change the color to red.
I’ve named the red one “Speech Bubble Font Evil”. -
Added new variable in SpeechBatched.js → @HideInInspector var isEnemy : boolean;
-
See if enemy, isEnemy = (player.alliance != alliance); // if different faction, enemy
-
Added new reference in SpeechBatchedManager.js → var printMat: Material;
Find the new material in inspector and give it to this -
In Print() of SpeechBatched.js added → if(isEnemy) text.renderer.sharedMaterial = manager.printMat;
-
In OnSayEnter() added → text.renderer.sharedMaterial = manager.textMat;
to go back to original material -
Done! from now on 1 more draw call will be added for evil colored material but also batched themselves
Hey I’m interested in the 2D speech bubbles. Is it possible to move the little triangle at the bottom of the bubble to one side or the other? Or a way to keep the text from going off of the screen? Maybe an alignment (left, right, center) feature?
Yep, you can move triangle at the bottom in 2D (It is a prefab with 2 GUI Textures)
Nope, that is not supported, hmmm I don’t even know if that will be possible in 2D, I think I can try that in 3D
Maybe If I use GUI Window but they are very heavy and not really a choice in mobile platform
If you really need that function, you can use GUILayout.Label in GUI Window and set window’s width not bigger than screen’s width instead of this asset ![]()
Yep, you can easily change alignment in prefab
Thank you for asset! Can I use it for Photon based chat?![]()
Definately, I’ve already done that with my game “Cuben” ![]()
Here is how I’ve used it with Photon
First, you will instantiate entities with this sort of line
PhotonNetwork.Instantiate("Etc/Entity", position, rotation, 0, data);
Second, the Photon Instantiated entities will get in here for initialization
function OnPhotonInstantiate(info : PhotonMessageInfo)
{
SetSpeech(); // you can set speech bubble here (Check out Youtube for better visualized presentation)
}
Thirdly, this RPC call will help you chat with speech bubbles
@RPC
function NotifySpeechSaid(str : String, second : int)
{
speech.SayNewLine(str, second); // and now every entity will see speech bubble on who's talking
}
Lastly, use below line whenever someone needs to talk
view.RPC("NotifySpeechSaid", PhotonTargets.All, str, 3);
That’s it ![]()
I’ve written it thinking that you know a bit on Photon
If you are completely new, I recommend you go through Photon tutorial (It’d be good for you and it is very easy too)
If you have any more questions, shoot away
Anyways, I’m glad you find this asset helpful for you project
have fun ![]()
(Edit)
Link to Photon tutorial : http://doc.exitgames.com/photon-cloud/Marco_Polo_Tutorial/
Hi is it possible to highlight the words (i.e. red) while they are being displayed using a timer? Like a karaoke, only display red on the word that’s actually being said?
Sorry, that’s not possible but you are tempting me
Does this use Unity 4 dynamic font rendering on iOS? Can it work with Japanese, Korean, Chineese, etc?
This prefab was made with Unity 3 so I’m not sure
I have tried no other languages but english
looks really nice
but it would be more usefull to me if this kit would also include a converstation editor.
Hi, I have purchased this and it simply doesn’t want to work.
If I follow your setup guide, when it comes to creating the javascript file, I enter the text but unity throws up errors about missing semicolons
I also work in c# and I tried to re-write the script to attach to the player in c# but I just got errors all over the place.
Here is the javascript that is not working at all.
#pragma strict
private var speech : SpeechBatched; // this entity's speech reference
var speechHolder : Transform; // position where speech bubble will stay, preferably right above a head
function Start () {
SetSpeech();
}
function Update () {
}
function SetSpeech()
{
speech = Instantiate(SpeechBatchedManager.bubble, speechHolder.localPosition, Quaternion.identity).GetComponent(SpeechBatched);
speech.holder = speechHolder; // pass holder
speech.Stop();
}
The error unity gives is “Assets/Scripts/Player/ScriptPlayerSpeech.js(7,9): UCE0001: ‘;’ expected. Insert a semicolon at the end.”
Oh, and I am also getting lots of warnings too when I imported the package:
Assets/Resources/Speech Bubble/3D (batch)/Scripts/Speech Batched Test Entity.js(28,9): BCW0015: WARNING: Unreachable code detected.
Ok scratch that, I got the script working, but how do I access it from a c# script?
If you could supply c# code for this it would be really great!
Here you go ![]()
Hi, your new version doesn’t work in 4.6 can you check it please?