|
I'm getting this error when trying to create a slider GUI to adjust mouse sensitivity while in game? I know the script is correct for accessing the MouseLook Script and variable, but I'm still getting the error: 'MouseLook.sensitivityX' is inaccessible due to its protection level. any Ideas?
(comments are locked)
|
|
If it is talking about protection level, then presumably the variable is not "public", e.g. It's public in the default version of the script. MouseLook is a standard asset, and its definition is "public float sensitivityX;", so unless this person modified their script, this isn't the problem.
May 03 '10 at 02:07 AM
qJake
Thank you, that was the problem. I don't know why I didn't think of it myself. I hadn't set the var to public, and it's not set that way by default in my version, and I'm using the standard assets version too. so, I dunno what's up, but it works now, thanks.
May 03 '10 at 02:29 AM
CalledToGaming
Correction. When I moved the Var to a static, I accidentally erased the public part. That was my problem. thanks for the help guys.
May 03 '10 at 02:32 AM
CalledToGaming
(comments are locked)
|
|
You can't just call the sensitivityX property of your script, that's not how the scripting works. You need to get a reference to the MouseLook script before you can change it. Like this: Well, I've done it with other variables in scripts and it works just fine, this is the first time I've had this error.
May 03 '10 at 12:51 AM
CalledToGaming
That's because those other scripts have their variables set to static. I don't mean to sound harsh, but if you don't know programming very well, Unity isn't the best place to start, as there are a lot of quirks that aren't present in regular programming.
May 03 '10 at 01:17 AM
qJake
The sensitivytX variable is set to static as well...
May 03 '10 at 01:20 AM
CalledToGaming
It isn't static in my version of the script (unmodified): http://img98.imageshack.us/img98/7418/nostatic.png - Did you modify it?
May 03 '10 at 02:00 AM
qJake
um thats not true a variable does NOT have to be static in order to be accessible by another script thats why we have public and private variables GetComponent(somescript).somevar=something;
Oct 29 '12 at 02:41 AM
lil_billy
(comments are locked)
|
