• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Feb 04, 2015 at 01:04 PM by fafase for the following reason:

Question is off-topic or not relevant

avatar image
0
Question by Digital-Phantom · Feb 04, 2015 at 12:23 PM · c#javascriptvariablefunctionconvert

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.

???

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image sniper43 · Feb 04, 2015 at 12:53 PM 1
Share

For the public part, assuming 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.

avatar image fafase · Feb 04, 2015 at 01:08 PM 2
Share

Well, if static is confusing you, you should get back to the basic of programming. Not trying to be condescendant but static is a basic feature of programming 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)".

0 Replies

  • Sort: 

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

20 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

converting javascript to c# 1 Answer

Lower player's health from separate script. 2 Answers

Clicking on an Object to Make it the Variable Target 1 Answer

How to correctly send a variable to another function? 1 Answer

C# to UnityScript conversion help. 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges