Quantcast
Channel: Questions in topic: "get"
Viewing all articles
Browse latest Browse all 215

if statement in a get function

$
0
0
So I'm working on a project with a camera where i have the camera but other team members don't so i have 2 different object groups 1 virtual and 1 that works with the camera. So I'm trying t make a index script that checks what your using and grabs all the info needed so are you using camera? grab fov from the camera, are you using virtual? grab fov virtual and set them as a get function so what i tried was this: public static float get_FOV(){ if (virtuEnabled) { return CameraCapture.getfovY; } else { return MouseLook.getFOV; } } i also tried it like this: public static float get_FOV { get { if (virtuEnabled) { return CameraCapture.getfovY; } else { return MouseLook.getFOV; } } } the virtuEnable is a bool set true or false depending what your using. now the problem that im having is that it gives me this error Assets/Scripts/varLibrary.cs(47,7): error CS0120: An object reference is required to access non-static member `varLibrary.virtuEnabled' line 74 is refering to the if (virtuEnabled) { any help in this matter would help alot!

Viewing all articles
Browse latest Browse all 215

Trending Articles