|
I just switched from UnityScript to C#. I have some custom classes I instantiate within the script attached to a GameObject. When I was using US, I used to be able to see those and all their instance members in the Inspector. Now I cannot - is this an inherent limitation of using C# or can I somehow make those appear again in the Inspector?
(comments are locked)
|
|
They need to be Serializable and public. See the following snippet: These are the droids I'm looking for.
Jul 04 '11 at 12:29 PM
robinking
(comments are locked)
|
|
Only classes that inherit from MonoBehaviour can be attached to GaneObjects. That's a limitation of Unity, not of a specific language. In UnityScript you can omit the class construct and Unity will inherit your class automatically form MonoBehaviour. In C# you have to do that yourself. If you talk about custom data classes and you have a vatiable on a MonoBehaviour that is holding a class instance, to see it in the inspector your have to add the attribute System.Serializable. In Unityscript all classes are implicitly serializable. Yes, I'm referring to custom data classes, not the MonoBehaviour. Thanks!
Jul 04 '11 at 12:30 PM
robinking
(comments are locked)
|
