Hey folks,
so let me begin by shortly describing what I want to do, then let me introduce you to my problem. So w/o further ado: I want to re-make my old escape menu, I did back in the beginning of my apprenticeship, but now with another background, that being, among others, having more modularity. Anyways, I wanted to have my mouseFree variable be self-administrated and I also only want to be able to have the TrueFirstCam and ThirdCam functionality (which you'll in my code), if mouseFree is false.
So here's my problem: I basically have set up a boolean variable, called "mouseFree" (or in this case I've hidden it and erected 2 new vars: "getMouseFree" and "setMouseFree"), and I want the varibale to administrate itself during runtime, which mean's, that it should set itself to false, if Cursor.lockstate == CursorLockMode.Locked, yadeyadeyada, but if write any line, trying to obtain the current state of the variable (via getMouseFree, obviously), Unity throws a StackOverFlowException based 'too much getting', so to say.
Here's what the console say's:
StackOverflowException: The requested operation caused a stack overflow.
ply_stats.get_getMouseFree () (at Assets/Scripts/ply_stats.cs:11)
ply_stats.get_getMouseFree () (at Assets/Scripts/ply_stats.cs:11)
[and so on]
Now, that's my problem, and the question is: how could I resolve this? Can't find the reason it overflows.
Yes, I have tried making the original variable public and using it instead, but if I recall correctly, it didn't work as well, and yes I also tried commenting out other code-blocks, which constantly called one of the extra variables, but that didn't work as well.
Oh, before I forget, here are my scripts! I tried commenting out as much as (I thought) needed for getting into my code (yes, blame me for killing it with using switch instead of if xD).
Oh, I removed the line, where StackOverflow get#s triggered, because, as described above, no matter how, but trying to *get* the value will cause it (for example: **print(PlayerStats.getMouseFree);** causes it, so something like a switch-statement will do too) .
ply_stats.cs (which holds every variable a user has, nothing else)
http://pastebin.com/gDQzNGJb
ply_controlBehav.cs (which basically holds every method for when keys/buttons are pressed on keyboard/mouse/joystick)
http://pastebin.com/Ezr288M6
ply_hudBehav.cs (which holds the functionality for every single element on the VGUI/HUD)
http://pastebin.com/1CDzeGgS
Now, that's everything I could think of right now. If I am missing information, that you need, then tell me!
Thanks in advance, and hopefully we'll get this solved.
↧