As I commented in the player script I’m trying to call the inventory function inside the HUD class from Player.cs. I have looked all over online and nothing is working, any suggestions?
Player.cs
using UnityEngine;
using System.Collections;
public class Player : MonoBehaviour {
public Transform firstperson;
public Camera fps_cam;
public Camera tps_cam;
public bool inInventory = false;
private Vector3 moveDirection = Vector3.zero;
void Start() {
fps_cam.enabled = true;
tps_cam.enabled = false;
}
void Update (){
if(Input.GetButtonDown("Fire1")) {
Screen.lockCursor = true;
}
Controls();
}
void Controls() {
//Change POV
if(Input.GetKeyDown(KeyCode.KeypadEnter)) {
fps_cam.enabled = !fps_cam.enabled;
tps_cam.enabled = !tps_cam.enabled;
}
if(Input.GetKeyDown(KeyCode.I)) {
//trying to call HUD.inventory(true) here
}
}
}
HUD.cs
using UnityEngine;
using System.Collections;
public class HUD : MonoBehaviour {
void Update() {
}
public void Inventory(bool open) {
if(open)
print ("test");
}
void OnGUI() {
}