Add VRChat and GitHub packages to Unity project
This commit is contained in:
1 parent
0334a52b21
commit
85538aaccc
3297 files changed
+847877
No files matched your search
+27
@@ -0,0 +1,27 @@
|
||||
using System.IO;
|
||||
using JetBrains.Annotations;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Experimental.AssetImporters;
|
||||
using UnityEngine;
|
||||
|
||||
namespace VRC.Udon.Editor.ProgramSources
|
||||
{
|
||||
[ScriptedImporter(1, "uasm")]
|
||||
[UsedImplicitly]
|
||||
public class UdonAssemblyProgramAssetImporter : ScriptedImporter
|
||||
{
|
||||
public override void OnImportAsset(AssetImportContext ctx)
|
||||
{
|
||||
UdonAssemblyProgramAsset udonAssemblyProgramAsset = ScriptableObject.CreateInstance<UdonAssemblyProgramAsset>();
|
||||
SerializedObject serializedUdonAssemblyProgramAsset = new SerializedObject(udonAssemblyProgramAsset);
|
||||
SerializedProperty udonAssemblyProperty = serializedUdonAssemblyProgramAsset.FindProperty("udonAssembly");
|
||||
udonAssemblyProperty.stringValue = File.ReadAllText(ctx.assetPath);
|
||||
serializedUdonAssemblyProgramAsset.ApplyModifiedProperties();
|
||||
|
||||
udonAssemblyProgramAsset.RefreshProgram();
|
||||
|
||||
ctx.AddObjectToAsset("Imported Udon Assembly Program", udonAssemblyProgramAsset);
|
||||
ctx.SetMainObject(udonAssemblyProgramAsset);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user