|
Hi, I see from an answer here that Unity Javascript supports C# properties. Can it also support C# Indexed Properties (as described here)? That is can I somehow write a Unity Javascript class like the C# class below: I tried guessing a few syntax combinations, but none would compile. Is this possible?
(comments are locked)
|
|
No, UnityScript ia a proprietary language which is build on top of Mono, but they didn't support all features. You can declare "normal" properties, but only when you have an explicit class construct around it and only simple, non-indexed. I've tried different ways to declare an Indexer like you want and had no luck yet ;) This is a rarely used feature of C# so i don't think they implement it in UnityScript. You have to use methods instead. btw. your Employee example is not very convenient ;) A good use of an indexer is the Vector3 struct:
(comments are locked)
|
