- Home /
Question by
Benjamin · Nov 09, 2010 at 12:28 PM ·
classbce0044javascript-specificnested
Are inner classes possible in Unity JavaScript?
If so, what am I doing wrong here?
class OuterClass {
var ic : InnerClass;
function OuterClass() {
ic = new InnerClass();
ic.DoSomething();
}
class InnerClass {
function DoSomething() {
Debug.Log("Something done.");
}
}
}
gives the error:
BCE0044: expecting }, found 'class'.
Comment
Answer by Mike 3 · Nov 09, 2010 at 12:58 PM
The example you gave is missing loads of braces, but you're right - it doesn't look like javascript supports nested classes
Ah, your answer suggested it was a 'probably not' - are you certain?
It seems to work! Glad you discovered this, it'll be handy when migrating code from UD$$anonymous$$