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

Spawning Player After Player Choice.

Hello everyone !

So t$$anonymous$$s is what I need. The player will have to make a choice of what they want to play before the game starts. T$$anonymous$$s 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

People who like this

0 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
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
 }

T$$anonymous$$s 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

People who like this

0 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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

39 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

Related Questions

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

Player spawning systems. 1 Answer

Side scroller spawns at different Y 1 Answer

Dynamically saving and loading player-created prefabs 0 Answers

Modify only the y axis in created animation 0 Answers


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