|
|
@@ -57,9 +57,18 @@ namespace AUMSS.EditorTools
|
|
|
{
|
|
|
if (program == null || program.sourceCsScript == null) continue;
|
|
|
if (!AssetDatabase.GetAssetPath(program).StartsWith(PackagePath)) continue;
|
|
|
- if (program.fieldDefinitions == null) return true;
|
|
|
+ if (!IsCompiled(program)) return true;
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
+ static bool IsCompiled(UdonSharpProgramAsset program)
|
|
|
+ {
|
|
|
+ // The field definitions alone aren't enough: reimporting an uncompiled program (an update while the editor is
|
|
|
+ // open) clears its compiled program but leaves the field definitions from before in memory
|
|
|
+ if (program.fieldDefinitions == null) return false;
|
|
|
+ using (var serialized = new SerializedObject(program))
|
|
|
+ return serialized.FindProperty("serializedUdonProgramAsset")?.objectReferenceValue != null;
|
|
|
+ }
|
|
|
}
|
|
|
}
|