does this look ok? public void ExportSimBatch() { GetSimChildren(); foreach (GameObject…
- User
does this look ok?
public void ExportSimBatch() { GetSimChildren();
foreach (GameObject mesh in SimObjects) { if(mesh.name != string.Empty) { ExportRuntime(mesh, SanitizeFilename(mesh.name)); } }}
- Assistant
Your method
ExportSimBatchlooks generally good, but there are a few improvements and best practices to consider:-
Null Check for
SimObjects: Ensure thatSimObjectsis not null before iterating over it to avoid possibleNullReferenceException. -
Use of
string.IsNullOrEmpty: Instead of checking if the name is not an empty string, you might want to usestring.IsNullOrEmpty(mesh.name)to also handle cases where the name is .
-