x


Picking a language...

I am new to unity and have been going through the reference guide and the scripting reference and as many examples as I can find. I am currently noticing that most of the examples in the reference are done in javascript which is really clean and straight forward. One of the things I am noticing is that certain things pop up in C# examples and I have not seen any javascript examples. Some of these include getter/setters (where you can utilize a variable by name not by calling "getVariableName()"), and extending classes. I am wondering if these are included in the javascript implementation and I am not finding reference to them, or if in order to utilize these features I should just make the jump over to C#. Any guidance from more experienced users would be greatly appreciated.

more ▼

asked Jan 18 '10 at 09:00 PM

Malcolm gravatar image

Malcolm
47 4 4 5

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

You can extend classes in JavaScript, see the example below. I don't think you can implement getters and setters, though, and there's some other features C# has, which you probably cannot do in JavaScript, like generics or delegate functions.

class MyPlayerEditor extends Editor
{
    function OnInspectorGUI()
    {
    }
}
more ▼

answered Jan 18 '10 at 10:03 PM

jonas echterhoff gravatar image

jonas echterhoff ♦♦
9.8k 7 23 104

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5272
x110
x74

asked: Jan 18 '10 at 09:00 PM

Seen: 1516 times

Last Updated: Jan 19 '10 at 09:55 AM