Added Unity project files

This commit is contained in:
2026-06-07 16:58:24 +01:00
parent 3cc05d260b
commit 23bbcab156
3942 changed files with 453676 additions and 0 deletions

View File

@ -0,0 +1,45 @@

using UdonSharp;
using UnityEditor;
using VRC.SDKBase.Editor.BuildPipeline;
namespace UdonSharpEditor
{
internal class UdonSharpBuildChecks : IVRCSDKBuildRequestedCallback
{
public int callbackOrder => -1;
/// <summary>
/// If you're considering commenting any section of this out, try enabling the force compile in the U# settings first.
/// This is here to prevent you from corrupting your project files.
/// If scripts are left uncompiled from Unity's side when uploading, there is a chance to corrupt your assemblies which can cause all of your UdonBehaviours to lose their variables if handled wrong.
/// </summary>
/// <param name="requestedBuildType"></param>
/// <returns></returns>
public bool OnBuildRequested(VRCSDKRequestedBuildType requestedBuildType)
{
UdonSharpSettings settings = UdonSharpSettings.GetSettings();
bool shouldForceCompile = settings.shouldForceCompile;
// Unity doesn't like this and will throw errors if it ends up compiling scripts. But it seems to work.
// This is marked experimental for now since I don't know if it will break horribly in some case.
if (shouldForceCompile)
{
AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate | ImportAssetOptions.ForceSynchronousImport);
}
else
{
AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
if (EditorApplication.isCompiling)
{
UdonSharpUtils.LogWarning("Scripts are in the process of compiling, please retry build after scripts have compiled.");
UdonSharpUtils.ShowEditorNotification("Scripts are in the process of compiling, please retry build after scripts have compiled.");
return false;
}
}
return true;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 67ef2f829963ac94db0d01f19c3a1caf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,39 @@

using UdonSharp;
using UdonSharp.Compiler;
using VRC.SDKBase.Editor.BuildPipeline;
namespace UdonSharpEditor
{
internal class UdonSharpBuildCompile : IVRCSDKBuildRequestedCallback
{
public int callbackOrder => 100;
public bool OnBuildRequested(VRCSDKRequestedBuildType requestedBuildType)
{
if (requestedBuildType == VRCSDKRequestedBuildType.Avatar)
return true;
if (UdonSharpSettings.GetSettings().disableUploadCompile)
return true;
UdonSharpCompilerV1.CompileSync(new UdonSharpCompileOptions() { IsEditorBuild = false });
UdonSharpEditorCache.SaveAllCache();
if (UdonSharpProgramAsset.AnyUdonSharpScriptHasError())
{
UdonSharpUtils.LogError("Failed to compile UdonSharp scripts for build, check error log for details.");
UdonSharpUtils.ShowEditorNotification("Failed to compile UdonSharp scripts for build, check error log for details.");
return false;
}
if (UdonSharpEditorManager.RunAllUpgrades())
{
UdonSharpUtils.LogWarning(UdonSharpEditorManager.UPGRADE_MESSAGE);
return false;
}
return true;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 32fdba3afe6c0a74d8714d0803e14c1a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: