- Home /
Question by
$$anonymous$$ · Apr 17, 2019 at 08:41 AM ·
c#scriptableobjectserializedpropertyserializedobject
How to iterate through all serialized property children ( deep search )
Hello guys, im trying to delete all object reference variables.This code finds properties in main serialized property and its first child, it doesnt look further, how can i get all children?
if (prop.NextVisible(true))
{
do
{
if (prop.propertyType == SerializedPropertyType.ObjectReference)
{
if (prop.objectReferenceValue != null && assets.Contains(prop.objectReferenceValue))
Object.DestroyImmediate(prop.objectReferenceValue, true);
}
}
while (prop.NextVisible(false));
}
Comment
Answer by Bunny83 · Apr 17, 2019 at 11:59 AM
Uhm, why do you pass false to NextVisible? Also if you just want to iterate through all serialized properties, you probably want to use Next(true) instead.