I have a inventory setup where I can move from the inventory array to the character equip array (each item in each array is displayed in a window) when I left or right click the button the item moves just fine.
But when I try to make it only work when you right click (and do nothing with left click) by adding an if statement saying if (event.current == 1) it will move the item only with right click but it will also move another item from a completely separate list that has nothing to do with it? Which is my bag array (each in the list is a bag) so I put a bag item in the bag array and when I right click an item it automatically moves the bag back to the inventory?
So for whatever reason I can’t use if(input.mousebutton(1)) in the OnGUI function …I have also tried to use that if statement in Update to set a bool and if the bool is true then move the item.
It seems like if(GUI.button(0,0,0,0)“”) doesn’t actually prevent the function from proceding (I want it to only do the actions IF the button is right clicked) …regardless of left or right click inputit acts as if the button is already pressed? Why is that?
I will try to attach an example of the code
791231–28969–$test.cs (3.19 KB)
better detect it manually using Rect.Contains(mousePos) Input.Mousebutton(1). Rect is your Button rectangle.
I tried to mention that I tried that…I know I didn’t do the syntax correctly but you can see what I meant, I thought.
Anyways thanks for the response but it still doesn’t work.
Thanks again for the reply kaliber but I did try that a few weeks ago. I have tried it in every different arrangement I could think of not just both parameters in one if statement… you know what I mean. But it just won’t co-operate and I have tried putting the 3 GUI windows in question into different scripts and that causes all sorts of other problems. It is pretty much set up just like the reference examples for the commands I am using (which is only like three ) show so the only thing different is the action taken after the criteria is met but I have checked and doubled checked there isn’t a logical reason why it would do such a thing. Do you think it is possible that it is a bug with OnGUI itself? I mean it is a pretty simple thing I am trying to accomplish I guess…move an item from one array to another only if player right clicks…shouldn’t be this hard. I have other friends look at this that are quite good with c# and they can’t see any problems with it either. Is there perhaps a limit to how many GUI components you can have? …it is making so discouraged but trying to do the same things over and over is getting me nowhere I don’t know what to do .