Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Psyk16 · Dec 08, 2017 at 07:01 PM · cameraarraytext

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 '\n' 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

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Zetya96 · Dec 08, 2017 at 07:26 PM

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.

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 Psyk16 · Dec 08, 2017 at 07:29 PM

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!!!

Comment
Add comment · Show 11 · 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 Zetya96 · Dec 08, 2017 at 07:32 PM 0
Share

For 2 camera only?

avatar image Psyk16 Zetya96 · Dec 08, 2017 at 07:38 PM 0
Share

I currently am just using 1 camera, and moving it's location to a predeter$$anonymous$$ed Transform. Sorry, I forgot I changed my plan a little bit ago. But, if it's easier I can create another camera.

avatar image Zetya96 Psyk16 · Dec 08, 2017 at 07:40 PM 0
Share

If you have the positions in an array, then its cleaner, then having multiple cameras (I think).

EDIT: sorry, I guess you have transforms in the array, because I assume you change the rotation of the camera, too?

Show more comments

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

121 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 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 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 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 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 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 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

How to make UI elements same size regardless of distance 1 Answer

world canvases z fighting or rendering in the order when camera moves around 0 Answers

How to display text with the GUI Text object when using the Ultimate FPS Camera Asset 0 Answers

Accessing next Camera from array 1 Answer

Reference other scrips in prefab 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