- Home /
Duplicate Question : http://answers.unity3d.com/questions/644949/how-do-i-check-if-a-derived-class-is-a-certain-cla.html
How do I check if a derived class is a certain class?
For example,
I have ScriptableObject A and then 3derived class A1 A2 A3
There is also Runtime Class B and derived from it, B1 and B2
B1 can only use A1 and A3 B2 can only use A2
And finally, there is manager Class C
Class C can only call function from base class B, But the said function can received any version of classA
As such, class B1 and B2 have a need to check which kind of A they are receiving.
public class B1 { void Update() { if( A is not A1 or A2 ) return; }
}
Follow this Question
Related Questions
C# finding gameobject that created this class, and do I need to clear them? 1 Answer
How do I check if a derived class is a certain class? 1 Answer
[CLOSED] How do I check if a derived class is a certain class? 0 Answers
Convert SerializedProperty to Custom Class 7 Answers
How to declare multiple variables using a for loop in class declaration? 0 Answers