From 5b3ad94cbc6c85c6f273ae782888ed94315ea957 Mon Sep 17 00:00:00 2001 From: Merlin <36685500+Merlin-san@users.noreply.github.com> Date: Tue, 14 Apr 2020 21:42:57 -0700 Subject: [PATCH] Make creating a new script dirty the program asset it gets assigned to --- Assets/NewScriptAAA.cs | 13 +++++++ Assets/NewScriptAAA.cs.meta | 11 ++++++ .../UdonSharp/Editor/UdonSharpProgramAsset.cs | 11 ++++-- .../Scripts/New Udon C# Program Asset.asset | 36 +++++++++++++++++++ .../New Udon C# Program Asset.asset.meta | 8 +++++ 5 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 Assets/NewScriptAAA.cs create mode 100644 Assets/NewScriptAAA.cs.meta create mode 100644 Assets/UdonSharp/Scripts/New Udon C# Program Asset.asset create mode 100644 Assets/UdonSharp/Scripts/New Udon C# Program Asset.asset.meta diff --git a/Assets/NewScriptAAA.cs b/Assets/NewScriptAAA.cs new file mode 100644 index 00000000..97966ccd --- /dev/null +++ b/Assets/NewScriptAAA.cs @@ -0,0 +1,13 @@ + +using UdonSharp; +using UnityEngine; +using VRC.SDKBase; +using VRC.Udon; + +public class NewScriptAAA : UdonSharpBehaviour +{ + void Start() + { + + } +} diff --git a/Assets/NewScriptAAA.cs.meta b/Assets/NewScriptAAA.cs.meta new file mode 100644 index 00000000..3a4ed057 --- /dev/null +++ b/Assets/NewScriptAAA.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e2ed4ba8d047dbe499764654ab559e96 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/UdonSharp/Editor/UdonSharpProgramAsset.cs b/Assets/UdonSharp/Editor/UdonSharpProgramAsset.cs index 592c4875..71df0b13 100644 --- a/Assets/UdonSharp/Editor/UdonSharpProgramAsset.cs +++ b/Assets/UdonSharp/Editor/UdonSharpProgramAsset.cs @@ -102,7 +102,10 @@ protected override void DrawProgramSourceGUI(UdonBehaviour udonBehaviour, ref bo if (sourceCsScript == null) { - DrawCreateScriptButton(); + if (DrawCreateScriptButton()) + { + dirty = true; + } return; } @@ -301,7 +304,7 @@ public IUdonProgram GetRealProgram() return program; } - private void DrawCreateScriptButton() + private bool DrawCreateScriptButton() { if (GUILayout.Button("Create Script")) { @@ -321,8 +324,12 @@ private void DrawCreateScriptButton() AssetDatabase.Refresh(); sourceCsScript = AssetDatabase.LoadAssetAtPath(chosenFilePath); + + return true; } } + + return false; } private static MonoScript currentUserScript = null; diff --git a/Assets/UdonSharp/Scripts/New Udon C# Program Asset.asset b/Assets/UdonSharp/Scripts/New Udon C# Program Asset.asset new file mode 100644 index 00000000..49d32fcc --- /dev/null +++ b/Assets/UdonSharp/Scripts/New Udon C# Program Asset.asset @@ -0,0 +1,36 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3} + m_Name: New Udon C# Program Asset + m_EditorClassIdentifier: + serializedUdonProgramAsset: {fileID: 11400000, guid: 8ecced45f35449641a2221b66a6f98ad, + type: 2} + udonAssembly: + assemblyError: + sourceCsScript: {fileID: 0} + behaviourIDHeapVarName: + compileErrors: [] + debugInfo: + serializedDebugSpans: [] + hasInteractEvent: 0 + serializationData: + SerializedFormat: 2 + SerializedBytes: + ReferencedUnityObjects: [] + SerializedBytesString: + Prefab: {fileID: 0} + PrefabModificationsReferencedUnityObjects: [] + PrefabModifications: [] + SerializationNodes: + - Name: fieldDefinitions + Entry: 6 + Data: diff --git a/Assets/UdonSharp/Scripts/New Udon C# Program Asset.asset.meta b/Assets/UdonSharp/Scripts/New Udon C# Program Asset.asset.meta new file mode 100644 index 00000000..bce6dbd7 --- /dev/null +++ b/Assets/UdonSharp/Scripts/New Udon C# Program Asset.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f11ebba0cf989254e84d6df4a282f360 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: