Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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, 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.

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 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)".

0 Replies

  • Sort: 

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

Need to use 2 different language scripts. 1 Answer

Access a JavaScript variable from a C# script? 2 Answers

Javascript and C#, different behaviour in inspector ? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges