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 Warhulk1745 · Jan 25, 2016 at 07:40 PM · prefabplayerloadingspawningspawning problems

Spawning Player After Player Choice.

Hello everyone !

So this is what I need. The player will have to make a choice of what they want to play before the game starts. This of course is in a separate scene in the game.

So the player has a choice of 2 different kinds of characters, character A or character B. I have both characters already saved in a prefab. How do I make it so that it spawns what the character chose in the previous scene. I'm using C# so please make your answers in C# code.

I hope you guys understand what I need! Thanks in advance !

Comment
Add comment · Show 1
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 ShadyProductions · Jan 25, 2016 at 07:45 PM 0
Share

This ain't a request forum.
Learn basic coding, its not that hard.

1 Reply

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

Answer by SterlingSoftworks · Jan 25, 2016 at 09:28 PM

In your "character choosing" script set up two public static bools. Then when the user chooses their character set the corresponding bool to true, and the other to false.

Then in your next scene all you need to do in your "character spawning" script is, in Start() write the name of your character choosing script like so

 if(characterChoosingScript.characterOneBool == true){
 //Spawn character 1
 }

This should be all you need to get your current request working.

If you have more than say, 4-5 characters, I'd recommend moving to an array of bools vs. individual.

Happy programming :)

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 Warhulk1745 · Jan 26, 2016 at 02:09 PM 0
Share

Thanks for going out of your way to help me out. It's people like you that make the lives of us still learning easy. I'll accept your answer, but I haven't test the suggestion yet. For those following this question, I will post my script as soon as I can.

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

40 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

Related Questions

Player don't spawn in build only, no log 0 Answers

Disfigured sprite after build. 0 Answers

Multiple Save (Saving & Loading System) With PlayerPrefs 2 Answers

How do you spawn multiple prefabs within a certain distance from each other from one spawn point? 2 Answers

Move Player to new scene without it resetting. 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