Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Larsson · Feb 27, 2012 at 12:33 PM · gamecharactersfighting

Fighting game with 2 characters and be able to change character

Hi, Im doing a Fighting game and I need to be able to change character for both player 1 and player 2. But I obviously do not know how to do this any help is appreciated. Thank you.

Comment
Add comment · Show 3
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 CHPedersen · Feb 27, 2012 at 12:54 PM 0
Share

This question is far too broad. You haven't specified what part you need help with.

avatar image lvictorino · Feb 27, 2012 at 01:45 PM 0
Share
  • Christian. Please give us more informations about your problem.

avatar image Larsson · Feb 27, 2012 at 02:06 PM 0
Share

what I want to be able to have a menu and be able to choose 2 characters for 2 diffrent players that you can play with 2 diffrent xbox gamepads, so my problem is: how do i set starting positions to player 1 and player 2 without knowing which character they will choose? can I set a variable to the gamepads?

1 Reply

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

Answer by Romano185 · Feb 27, 2012 at 02:51 PM

To select the 2 characters you can make prefabs of both of them, and assign the spawn points to the gamepads. I don't know how to assign spawn points to gamepads, but I'm sure someone knows how to do this. You can use this script to spawn the characters, assign the script to the spawning point(s):

 static var classselected : boolean = false;
 var spawnplace : Transform;
 var firstcharacterobject : GameObject;
 var secondcharacterobject : GameObject;
 
 function OnGUI () {
 
 if(classselected == false){
 GUI.Box(Rect(0,0,300,500),GUIContent("Choose your class wisely"));
 }
 
 if(GUI.Button(Rect(100,100,100,100),GUIContent("First Character")) && classselected == false ){
 var instance : GameObject = Instantiate(firstcharacterobject, spawnplace.position, spawnplace.rotation);
 classselected = true;
 }
 
 if(GUI.Button(Rect(100,200,100,100),GUIContent("Second Character")) && classselected == false){
 var instance2 : GameObject = Instantiate(secondcharacterobject, spawnplace.position, spawnplace.rotation);
 classselected = true;
 }
 }
 
 function Update (){
 if (classselected == true){
 Destroy(gameObject);
 }
 }

Just assign the transform of the spawn point and the 2 prefabs in the inspector.

Lots of luck with your fighting game

Comment
Add comment · Show 2 · 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 Larsson · Feb 28, 2012 at 09:30 AM 0
Share

Thank you very much!! :)

avatar image collectorgamedev · Feb 11, 2013 at 03:08 AM 0
Share

Where do I put the script?

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

8 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

how do I set up a character selection menu? 2 Answers

Can you create characters only using unity? 1 Answer

Fighting Game Camera 1 Answer

Jumpy/flashing characters in Jumpstart game 1 Answer

2D bullet script errors. 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