- Home /
Question is off-topic or not relevant
What is this C# code in javascript
Could somebody please tell me what this line of code would be in javascript
public static void DeselectGameobjectIfSelected();
I'm thinking its meant to be a function, but then I'm confused by the public static part, which make me think variable.
???
For the public part, assu$$anonymous$$g the method is cointained withing a class called Temp like so:
class Temp
{
public static void DeselectGameobjectIfSelected();
}
you can then call the method via script form another class like so:
class OtherClass { void $$anonymous$$ethod() { Temp.DeselectGameobjectIfSelected(); } }
The static part is a bit more complicated and I-ll just poitn zou to the documentation:
https://msdn.microsoft.com/en-us/library/vstudio/98f28cdx%28v=vs.100%29.aspx
A concise description would to say that a static object belongs to a TYPE rather than an instnace of a class.
I think ins$$anonymous$$d of using static you should try out a singleton way of making script.
Well, if static is confusing you, you should get back to the basic of program$$anonymous$$g. Not trying to be condescendant but static is a basic feature of program$$anonymous$$g languages, not only C# but all OOP (don't go and read about static in C) so you should find a tutorial playlist on Youtube and get back next week (which is the time it will take to watch them all) so that you can have this moment of "Right, Let's get it on now!! (That's what she says)".