Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //MenuGUI.css
- using UnityEngine;
- using System.Collections;
- public class MenuGUI : MonoBehaviour {
- // Use this for initialization
- void Start () {
- }
- // Update is called once per frame
- void Update () {
- }
- void OnGUI() {
- GUI.Box (new Rect (10, 10, 100, 200), "Weapons");
- //GUI.Box (new Rect (Screen.width - 200, Screen.height - 200, 400, 400), "Inventory");
- if (GUI.Button (new Rect (15, 35, 90, 20), "Sniper")) {
- WieldWeapon.PickUpWeapon("sniper");
- Debug.Log("Sniper retrieved");
- }
- }
- }
- //WieldWeapon.css
- using UnityEngine;
- using System.Collections;
- public class MenuGUI : MonoBehaviour {
- // Use this for initialization
- void Start () {
- }
- // Update is called once per frame
- void Update () {
- }
- void OnGUI() {
- GUI.Box (new Rect (10, 10, 100, 200), "Weapons");
- //GUI.Box (new Rect (Screen.width - 200, Screen.height - 200, 400, 400), "Inventory");
- if (GUI.Button (new Rect (15, 35, 90, 20), "Sniper")) {
- WieldWeapon.PickUpWeapon("sniper"); // <---------------------- Error here
- Debug.Log("Sniper retrieved");
- }
- }
- }
- //Erreur: Assets/Scripts/MenuGUI.cs(21,37): error CS0120: An object reference is required to access non-static member `WieldWeapon.PickUpWeapon(string)'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement