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 $$anonymous$$ · Jul 10, 2019 at 02:40 PM · scripting problemmenusetactivecustomizationarmor

need help with armor customization

Hi, I'm working on a Fan made halo game called Project BackBurn. And I'm wondering how I would handle armor customization for the Spartan's. I have all the armor pieces attached to the under suit that is rigged. So would I have a button that sets each armor piece active using "Set Active" and the same for disabling armor pieces? But how would that effect it in the actual game? Ughhh I need help.

Comment
Add comment · Show 2
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 tormentoarmagedoom · Jul 11, 2019 at 01:36 PM 0
Share

Hello.

Your question is unclear... If you know you can make buttons that "active or unactive" the object, where is the problem?

and what you mean with effect it in the actual game?

avatar image $$anonymous$$ tormentoarmagedoom · Jul 11, 2019 at 02:19 PM 0
Share

Ok so say I have a several buttons for each armor set. If I customize my armor to whatever I want how would I have the game change the armor in the custom games or matchmaking?

1 Reply

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

Answer by akaBase · Jul 11, 2019 at 02:44 PM

You need to brake it down into different parts.


First have a script on each Armor Piece parent with some info about it and the ability to change the Armour pieces active status, example below.


 public class ArmorPiece : MonoBehaviour
 {
     public string id;
     public GameObject armorPiece;
     public bool isActive;
 
     public void ToggleActiveState()
     {
         isActive = !isActive;
         armorPiece.SetActive(isActive);
     }
 }


And then some sort of Manager for all ArmorPieces, example below.


 public class ArmorManager : MonoBehaviour
 {
     public GameObject[] armorGameObjects; 
     public Dictionary<string, ArmorPiece> armorPieces;
 
     private void Start()
     {
         armorPieces = new Dictionary<string, ArmorPiece>();
 
         foreach (GameObject armorGameObject in armorGameObjects)
         {
             ArmorPiece armorPiece = armorGameObject.GetComponent<ArmorPiece>();
             if (armorPiece != null)
             {
                 armorPieces.Add(armorPiece.id, armorPiece);
             }
         }
     }
 
     public void ToggleArmorStatus(string armorID)
     {
         if (armorPieces.ContainsKey(armorID))
         {
             armorPieces[armorID].ToggleActiveState();
         }
     }
 }


And then to toggle Armor pieces create buttons with the that onclick point to ToggleArmorStatus with the id of that buttons Armor Piece as the value.


That is just pseudo code but gives you more than enough to go on, and gives an idea on how to brake things down into the different parts needed to accomplish something a little more complex.

Comment
Add comment · Show 4 · 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 $$anonymous$$ · Jul 11, 2019 at 05:05 PM 0
Share

Thanks so much.

avatar image $$anonymous$$ · Jul 11, 2019 at 06:00 PM 0
Share

now how would it be saved for my profile for say and it show up in the custom game?

avatar image akaBase $$anonymous$$ · Jul 11, 2019 at 06:36 PM 0
Share

Not entirely sure what you mean by my profile and custom game but if you wish for the settings to persist between games you could turn the ArmorPieces Dictionary into a json and save that resulting string with PlayerPrefs (Due to JsonUitlity limitations you will need to create a struct to hold the dictionary for serialization)

avatar image $$anonymous$$ akaBase · Jul 11, 2019 at 06:57 PM 0
Share

Ok thanks.

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

107 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

Related Questions

UNITY 2D: How to make a level selection menu (like the video in details)? 1 Answer

I'm making multiple characters, how can I use them in new scenes? 0 Answers

Script problem 1 Answer

Unity SetActive() doesn't activate object 1 Answer

Disable Gameobject Via Script 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