- Home /
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
Either have them present but not renderered, or instantiate them as required.
Your answer

Follow this Question
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