- Home /
Method is called, but GUI doesn't show up
I have a chest that is supposed to display either player inventory or the chest's inventory. The first menu has buttons to choose which of the inventories to display, when I click the buttons, it stays on the same screen, but I put a debug.log in each of them and the both get called when I click the button for them. Unless I made a stupid mistake, the menu system isn't the problem, I've been using it for months. I don't know what is though. I would really appreciate some help with this, it's driving me crazy.
Here is the chest script: http://pastebin.com/NvwBPtdU
Here is the inventory script that it relies on: http://pastebin.com/6UkaqgfL
And here is the item script that they both rely on: http://pastebin.com/DcwUtMBs
The places to look in the chest script are InvChest() and InvMine()
Also, sorry for posting whole scripts, I just don't know where the problem is being caused from.
Going through your code, I spotted something see$$anonymous$$gly unrelated to your problem, but thought I would mention it. In the Chest class, canClick is never set to false again:
void OnTriggerEnter(Collider other) {
canClick = true;
}
void OnTriggerExit(Collider other){
canClick = true;
}
Answer by VioKyma · Mar 15, 2014 at 12:28 AM
The actual problem seems to be here:
if(open == true) {
currentMenu = "Sel";
player.GetComponent<FirstPersonController>().enabled = false;
//player.GetComponent<BasicSettings>().enabled = false;
}
It will always set it back to "Sel" each time an Update occurs.
Maybe set the if statement to something like:
if(open == true && currentMenu == "") {
So it will only set it if the menu is not currently open.
Ah, I didn't even think about that. Thank you, it works now.
Your answer
Follow this Question
Related Questions
Using an On-Screen GUI Button to show a GUI? 1 Answer
Help with GUILayout and tooltip(C#) 1 Answer
GUI.Button is acting funky. 2 Answers