SolvedCannot explicitly call operator or accesor

Posts 18 of 8 · Page 1 of 1
Cannot explicitly call operator or accesor
If I try to compile something like this in visual studio I get this compiler error "'LightingManager.time.set' Cannot explicitly call operator or accsesor"
I am very new to coding and I know some basics and this is the only problem I have run in to. Any help would be much appreciated.

Thanks.


Code:
if (GUI.Button(new Rect(60f, 80f, 80f, 20f), "Set Day"))
				{
					LightingManager.set_time(15);
                                }
I have the same issue. :S
It throws an error due to the func being read-only. You need to use reflection to change the value.
What about this?
Code:
LightningManager.time = value;
- - - Updated - - -

What about this?
Code:
LightningManager.time = value;
Kr4ken, Kunii, as a coder you really should've known that
Quote Originally Posted by No007 View Post
What about this?
Code:
LightningManager.time = value;
- - - Updated - - -

What about this?
Code:
LightningManager.time = value;
Kr4ken, Kunii, as a coder you really should've known that
I think you meant LightingManger instead of LightningManager, and anyway LightingManager.time is a method not a variable.
Quote Originally Posted by Kunii View Post
It throws an error due to the func being read-only. You need to use reflection to change the value.
I'm going to try and learn about reflections. However, I'm confused because I decompiled a working unturned unity hack and it had a lot of get functions like the one i originally posted. If I tried to compile it I would get the same errors, but the hack still worked. I'm just wondering how the person who made it was able to get by the issue?

Edit
Is it just a problem with the decompiler that caused this?
Quote Originally Posted by canehdians View Post
I'm going to try and learn about reflections. However, I'm confused because I decompiled a working unturned unity hack and it had a lot of get functions like the one i originally posted. If I tried to compile it I would get the same errors, but the hack still worked. I'm just wondering how the person who made it was able to get by the issue?

Edit
Is it just a problem with the decompiler that caused this?
Unturned has been updated multiple times since bankroll came out. So most likely thats the reason, and not your decompiler.
Quote Originally Posted by Kr4ken View Post
I think you meant LightingManger instead of LightningManager
Yeah that was a typo xD

Quote Originally Posted by Kr4ken View Post
LightingManager.time is a method not a variable.
LightingManager.time is not a method, neither a variable. It is a property with both getter and setter, so you can implicitly call the setter by assigning a value to it as you would do with a variable.

Quote Originally Posted by canehdians View Post
I'm going to try and learn about reflections
Just use the method I suggested, I use it exactly that way in my private hack, works like a charm.
Posts 18 of 8 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?