Skip to content

Commit

Permalink
Make creating a new script dirty the program asset it gets assigned to
Browse files Browse the repository at this point in the history
  • Loading branch information
MerlinVR committed Apr 15, 2020
1 parent 06a70d3 commit 5b3ad94
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 2 deletions.
13 changes: 13 additions & 0 deletions Assets/NewScriptAAA.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;

public class NewScriptAAA : UdonSharpBehaviour
{
void Start()
{

}
}
11 changes: 11 additions & 0 deletions Assets/NewScriptAAA.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions Assets/UdonSharp/Editor/UdonSharpProgramAsset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ protected override void DrawProgramSourceGUI(UdonBehaviour udonBehaviour, ref bo

if (sourceCsScript == null)
{
DrawCreateScriptButton();
if (DrawCreateScriptButton())
{
dirty = true;
}
return;
}

Expand Down Expand Up @@ -301,7 +304,7 @@ public IUdonProgram GetRealProgram()
return program;
}

private void DrawCreateScriptButton()
private bool DrawCreateScriptButton()
{
if (GUILayout.Button("Create Script"))
{
Expand All @@ -321,8 +324,12 @@ private void DrawCreateScriptButton()
AssetDatabase.Refresh();

sourceCsScript = AssetDatabase.LoadAssetAtPath<MonoScript>(chosenFilePath);

return true;
}
}

return false;
}

private static MonoScript currentUserScript = null;
Expand Down
36 changes: 36 additions & 0 deletions Assets/UdonSharp/Scripts/New Udon C# Program Asset.asset
Original file line number Diff line number Diff line change
@@ -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:
8 changes: 8 additions & 0 deletions Assets/UdonSharp/Scripts/New Udon C# Program Asset.asset.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5b3ad94

Please sign in to comment.