Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/Lua.Unity/Assets/Sandbox/Editor.meta

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

66 changes: 66 additions & 0 deletions src/Lua.Unity/Assets/Sandbox/Editor/LuaSourceGeneratorImporter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
using System;
using UnityEditor;

namespace Lua.Unity.Editor
{
[InitializeOnLoad]
internal sealed class LuaSourceGeneratorImporter : AssetPostprocessor
{
private const string GeneratorPath =
"Packages/com.nuskey8.lua.unity.internal/Lua.SourceGenerator.dll";

static LuaSourceGeneratorImporter()
{
EditorApplication.delayCall += Configure;
}

private static void OnPostprocessAllAssets(
string[] importedAssets,
string[] deletedAssets,
string[] movedAssets,
string[] movedFromAssetPaths
)
{
if (Array.IndexOf(importedAssets, GeneratorPath) >= 0)
{
EditorApplication.delayCall += Configure;
}
}

private static void Configure()
{
if (AssetImporter.GetAtPath(GeneratorPath) is not PluginImporter importer)
{
return;
}

var changed = false;
if (importer.GetCompatibleWithAnyPlatform())
{
importer.SetCompatibleWithAnyPlatform(false);
changed = true;
}

if (importer.GetCompatibleWithEditor())
{
importer.SetCompatibleWithEditor(false);
changed = true;
}

var labels = AssetDatabase.GetLabels(importer);
if (Array.IndexOf(labels, "RoslynAnalyzer") < 0)
{
var updatedLabels = new string[labels.Length + 1];
Array.Copy(labels, updatedLabels, labels.Length);
updatedLabels[labels.Length] = "RoslynAnalyzer";
AssetDatabase.SetLabels(importer, updatedLabels);
changed = true;
}

if (changed)
{
importer.SaveAndReimport();
}
}
}
}

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

10 changes: 10 additions & 0 deletions src/Lua.Unity/Assets/Sandbox/Resources/test.luac.meta

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

12 changes: 6 additions & 6 deletions src/Lua.Unity/Assets/Sandbox/Sandbox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ public class Sandbox : MonoBehaviour
async void Start()
{
var state = LuaState.Create(
new LuaPlatform(
FileSystem: new FileSystem(Application.streamingAssetsPath),
OsEnvironment: new UnityApplicationOsEnvironment(),
StandardIO: new UnityStandardIO(),
TimeProvider: TimeProvider.System
)
LuaPlatform.Default with
{
FileSystem = new FileSystem(Application.streamingAssetsPath),
OsEnvironment = new UnityApplicationOsEnvironment(),
StandardIO = new UnityStandardIO()
}
);
state.ModuleLoader = CompositeModuleLoader.Create(
new AddressablesModuleLoader(),
Expand Down

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions src/Lua.Unity/Assets/StreamingAssets.meta

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

29 changes: 16 additions & 13 deletions src/Lua.Unity/Packages/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
"dependencies": {
"com.github-glitchenzo.nugetforunity": "https://github.com/GlitchEnzo/NuGetForUnity.git?path=/src/NuGetForUnity",
"com.nuskey8.lua.unity.internal": "file:../../Lua/bin/Debug/netstandard2.1",
"com.unity.addressables": "2.2.2",
"com.unity.ai.navigation": "2.0.4",
"com.unity.collab-proxy": "2.6.0",
"com.unity.ide.rider": "3.0.31",
"com.unity.ide.visualstudio": "2.0.22",
"com.unity.inputsystem": "1.11.1",
"com.unity.multiplayer.center": "1.0.0",
"com.unity.render-pipelines.universal": "17.0.3",
"com.unity.test-framework": "1.4.5",
"com.unity.timeline": "1.8.7",
"com.unity.ugui": "2.0.0",
"com.unity.addressables": "2.9.1",
"com.unity.ai.navigation": "2.0.14",
"com.unity.collab-proxy": "2.13.3",
"com.unity.ide.rider": "3.0.39",
"com.unity.ide.visualstudio": "2.0.26",
"com.unity.inputsystem": "1.19.0",
"com.unity.multiplayer.center": "1.0.1",
"com.unity.render-pipelines.universal": "17.5.0",
"com.unity.test-framework": "1.7.0",
"com.unity.timeline": "1.8.12",
"com.unity.ugui": "2.5.0",
"com.unity.modules.accessibility": "1.0.0",
"com.unity.modules.adaptiveperformance": "1.0.0",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
"com.unity.modules.animation": "1.0.0",
Expand All @@ -27,6 +28,7 @@
"com.unity.modules.particlesystem": "1.0.0",
"com.unity.modules.physics": "1.0.0",
"com.unity.modules.physics2d": "1.0.0",
"com.unity.modules.physicscore2d": "1.0.0",
"com.unity.modules.screencapture": "1.0.0",
"com.unity.modules.terrain": "1.0.0",
"com.unity.modules.terrainphysics": "1.0.0",
Expand All @@ -40,10 +42,11 @@
"com.unity.modules.unitywebrequestaudio": "1.0.0",
"com.unity.modules.unitywebrequesttexture": "1.0.0",
"com.unity.modules.unitywebrequestwww": "1.0.0",
"com.unity.modules.vectorgraphics": "1.0.0",
"com.unity.modules.vehicles": "1.0.0",
"com.unity.modules.video": "1.0.0",
"com.unity.modules.vr": "1.0.0",
"com.unity.modules.wind": "1.0.0",
"com.unity.modules.xr": "1.0.0"
"com.unity.modules.xr": "1.0.0",
"com.unity.pipeline": "0.8.0-exp.1"
}
}
1 change: 1 addition & 0 deletions src/Lua.Unity/Packages/nuget-packages/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
InstalledPackages/
Loading