fix null object error on cancel export

This commit is contained in:
David Back 2019-03-14 17:19:21 -07:00
parent 3c78e48f88
commit d8b4419fd0
2 changed files with 12 additions and 9 deletions

View file

@ -1531,6 +1531,7 @@ class ExportProjectWindow : EditorWindow {
float GetAvatarHeight() {
// height of an avatar model can be determined to be the max Y extents of the combined bounds for all its mesh renderers
if (avatarPreviewObject != null) {
Bounds bounds = new Bounds();
var meshRenderers = avatarPreviewObject.GetComponentsInChildren<MeshRenderer>();
var skinnedMeshRenderers = avatarPreviewObject.GetComponentsInChildren<SkinnedMeshRenderer>();
@ -1542,6 +1543,8 @@ class ExportProjectWindow : EditorWindow {
}
return bounds.max.y;
}
return 0.0f;
}
void SetAvatarScale(float actualScale) {
// set the new scale uniformly on the preview avatar's transform to show the resulting avatar size