- Home /
Question by
OliverAnthony · Sep 11, 2014 at 06:26 AM ·
classinheritanceclasses
Class extends Object but does not inherit variables
I have essentially the following:
class MyClass extends Object {
function MyClass () {
hideFlags = HideFlags.HideInHierarchy;
}
}
And after compiling, I'm getting an "Unknown identifier: 'hideFlags'" error. Am I not understanding inheritance properly? Object has the variable hideFlags, so shouldn't any class that extends from it?
Comment
Answer by Landern · Sep 11, 2014 at 06:27 AM
Qualify the Object type with the name space and you should be good to go, worked for me:
#pragma strict
class MyClass extends UnityEngine.Object {
function MyClass () {
hideFlags = HideFlags.HideInHierarchy;
}
}