How do I change which camera is active based on text dialogue?

Hello,

I haven’t found anything similar to this on the forum, so I apologize if I am re-posting an already solved issue.

Basically what I am trying to do is create a mini cut-scene. What I want to happen is to activate different cameras depending which character is currently “talking.” I have my text currently going into an array, split based on the ’
’ parameter in my Notepad file, and I can scroll through the text by pressing “Enter.” What I’m wondering is if I can somehow use this array to solve the problem. Can I somehow add a marker to the text that will allow Unity to recognize that, for example, “if there is an # next to the line, it’s speaker 1, and a is speaker 2." Then I could use those 2 "tags" of sorts to say "if text is of # group, activate camera 1" "if text is of group, activate camera 2.” I hope that I’m explaining myself correctly…

Thanks,
Drew

Well, if theres only 2 camera,you can just add a special character at the end of the string, and if the string ends with that char,then you switch camera.

If theres more camera,you can split your string into 2 part with like a splitter.

For example
Hello stranger|1

Then when you read the line, you split it, and the first part is your text, the second is the id of the camera,you want to set active.

This is exactly what I need! However, I’m not entirely sure how I would do this in the scripts/text itself. Could you give me an example code/text for say, the following text:

Person 1: Hey how are you?
Person 2: Good, you?
Person 1: Fine thank you.

What/where would I put these markers, and how do I then access them in the script?

Thanks for the quick reply!!!