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 thinkablegamer · Aug 03, 2014 at 03:48 PM · fpsweapon

Weapon customization Help needed

so i have been working on an fps game and i resently made a weapon customization script, you can customize the weapons like your supposed too but i dont know how to get them to load into the game itself someone pls help

 using UnityEngine;
 using System.Collections;
 
 public class Weapon : MonoBehaviour 
 {
     public string CurrentMenu;
 
     public GameObject G36_WEAPON;
 
         public GameObject Holo_Sight;
 
         public GameObject ACOG;
 
         public GameObject Silencer;
 
     void Start () 
     {
         CurrentMenu = "Hub";
         Holo_Sight.SetActive (false);
         ACOG.SetActive (false);
         Silencer.SetActive (false);
         G36_WEAPON.SetActive (false);
 
 void Update () {
 
     }
 
     public void NavigateTo(string nextmenu)
     {
         CurrentMenu = nextmenu;
     }
 
     void OnGUI()
     {
         if (CurrentMenu == "Primary")
             Primary ();
         if (CurrentMenu == "Hub")
             Hub ();
         if (CurrentMenu == "G36")
             G36 ();
         if (CurrentMenu == "G36_Optics")
             G36_OP ();
         if (CurrentMenu == "G36_Barrel")
             G36_Barrel ();
 
 public void Hub()
     {
         if (GUI.Button (new Rect (10, 10, 200, 50), "Primary")) 
         {
             NavigateTo ("Primary");
         }
     }
 
     private void Primary()
     {
         if (GUI.Button (new Rect (10, 10, 200, 50), "Back")) 
         {
             NavigateTo("Hub");
         }
         if (GUI.Button (new Rect (10, 70, 200, 50),                               "G36")) 
         {
             NavigateTo ("G36");
         }
 
 private void G36()
     {
         G36_WEAPON.SetActive (true);
         FAMAS_WEAPON.SetActive (false);
         AUG_WEAPON.SetActive (false);
         M16_WEAPON.SetActive (false);
         if (GUI.Button (new Rect (10, 10, 200, 50), "Back")) 
         {
             NavigateTo("Primary");
         }
         if (GUI.Button (new Rect (10, 70, 200, 50), "Optics")) 
         {
             NavigateTo("G36_Optics");
         }
         if (GUI.Button (new Rect (10, 130, 200, 50), "Barrel")) 
         {
             NavigateTo("G36_Barrel");
         }
     }
     private void G36_OP()
     {
         if (GUI.Button (new Rect (10, 10, 200, 50), "Back")) 
         {
             NavigateTo("G36");
         }
         if (GUI.Button (new Rect (10, 70, 200, 50), "None")) 
         {
             Holo_Sight.SetActive (false);
             ACOG.SetActive(false);
         }
         if (GUI.Button (new Rect (10, 130, 200, 50), "Holo_Sight")) 
         {
             Holo_Sight.SetActive (true);
             ACOG.SetActive(false);
         }
         if (GUI.Button (new Rect (10, 190, 200, 50), "ACOG")) 
         {
             Holo_Sight.SetActive (false);
             ACOG.SetActive(true);
         }
     }
     private void G36_Barrel()
     {
         if (GUI.Button (new Rect (10, 10, 200, 50), "Back")) 
         {
             NavigateTo("G36");
         }
         if (GUI.Button (new Rect (10, 70, 200, 50), "None")) 
         {
             Silencer.SetActive (false);
         }
         if (GUI.Button (new Rect (10, 130, 200, 50), "Silencer")) 
         {
             Silencer.SetActive (true);
         }

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 meat5000 ♦ · Aug 03, 2014 at 02:17 PM 0
Share

Either have them present but not renderered, or instantiate them as required.

0 Replies

· Add your reply
  • Sort: 

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

problem with weapon animation -.- 0 Answers

How do i get a weapon to follow the first person controller up and down? 0 Answers

Multiple Weapon Animation Help 0 Answers

pause for dastardly bannana 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