- Home /
Question by
Jeff-Kesselman · Aug 03, 2014 at 06:17 AM ·
serializationruntime
How to assign a class ID at runtime?
I'm working on runtime scripting and I feel like I am very close.
Using the C# evaluator I am able to create a class at run time that inherits from MonoBehaviour.
However when I try to assign it as a component I get the error "Invalid class ID = -1".
I assume Unity is keeping an internal table that maps classes to IDs for serialization purposes.
Can I add my class to that table in some way?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613155657im_/https://answers.unity.com/themes/thub/images/avi.jpg)