Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

Edit child in parent list [Custom Inspector]

$
0
0
As question suggests, I have [Serializable] public class Parent { public float myFloat; } [Serializable] public class Child : Parent { public string childString; } public class MonoClass : MonoBehavior { public List myList; } I have MonoClass attached to a gameobject. I can edit the list of Parent but if there's a Child in that list, I can't edit the Child (I can't assign values to childString). If I have a list of Parent objects, how can I basically get every object in the list to show a default editor for each class subtype? Now... I KNOW this requires a custom editor. I've done my research. However, nowhere have I seen HOW this can be accomplished. As a stretch goal, I'd like to be able to pick a subtype from a dropdown list to add to the list. That way I can add all eligible types to the list (and then of course, edit them). Cheers!

Viewing all articles
Browse latest Browse all 171066

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>