- Home /
Question by
Cornelis-de-Jager · Nov 06, 2018 at 08:48 AM ·
casting
Convert MonoScript.GetClass() to MonoBehaviour/Class
The title is self explanatory, please see code below:
public IList<Delegate> GetDelegateList(MonoScript script)
{
SpellComponent component = (SpellComponent) script.GetClass(); // <= Cast types do not work.
return component.DelegateList;
}
Essentially I do not know how to cast a type to a class.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612181621im_/https://answers.unity.com/themes/thub/images/avi.jpg)