- Home /
Script Wrapper Class
Trying to create a general purpose C# script that holds an array of various other script components. The problem is, I don't know what type allows me to 1) allows me to put a variety of scripts in the same array and 2) allows me to enable and disable the script component.
I tried using the Component
class, but there doesn't seem to be any way to enable or disable through this class. I also can't do a cast, since I'm using a variety of scripts, and I can't seem to use .getType
to cast.
Is there some type of superclass or wrapper class that I can use? Or is there maybe a better implementation? Any help is appreciated.
Answer by John_Sherer · Jul 31, 2016 at 09:30 PM
Behavior
is the class I was looking for apparently. An explicit cast is required, but it's very simple and works perfectly.
Going to keep this question up in case someone else has this question.
Your answer
Follow this Question
Related Questions
Instantiating objects from a class? (C#) 1 Answer
C# Array of Child Objects 1 Answer
Error passing class in method c# 3 Answers
C# Adding to an Array 1 Answer
Writing an class array to disk? 1 Answer