@@ -48,16 +48,7 @@ Install-Package LuaCSharp
4848
4949### Unity
5050
51- Lua-CSharp can also be used in Unity (works with both Mono and IL2CPP).
52-
53- ### Requirements
54-
55- * Unity 2021.3 or higher
56-
57- ### Installation
58-
59- 1 . Install [ NugetForUnity] ( https://github.com/GlitchEnzo/NuGetForUnity ) .
60- 2 . Open the NuGet window by going to ` NuGet > Manage NuGet Packages ` , search for the ` LuaCSharp ` package, and install it.
51+ You can also use Lua-CSharp with Unity. For details, see the [ Lua.Unity] ( #luaunity ) section.
6152
6253## Quick Start
6354
@@ -487,6 +478,51 @@ catch (LuaRuntimeException)
487478 }
488479```
489480
481+ ## Lua.Unity
482+
483+ Lua-CSharp can also be used in Unity (works with both Mono and IL2CPP).
484+
485+ ### Requirements
486+
487+ * Unity 2021.3 or higher
488+
489+ ### Installation
490+
491+ 1 . Install [ NugetForUnity] ( https://github.com/GlitchEnzo/NuGetForUnity ) .
492+
493+ 2 . Open the NuGet window by going to ` NuGet > Manage NuGet Packages ` , search for the ` LuaCSharp ` package, and install it.
494+
495+ 3 . Open the Package Manager window by selecting ` Window > Package Manager ` , then click on ` [+] > Add package from git URL ` and enter the following URL:
496+
497+ ```
498+ https://github.com/AnnulusGames/Lua-CSharp.git?path=src/Lua.Unity/Assets/Lua.Unity
499+ ```
500+
501+ ### LuaImporter / LuaAsset
502+
503+ By introducing Lua.Unity, files with the `.lua` extension can be treated as `LuaAsset`.
504+
505+ 
506+
507+ These assets can be used similarly to a standard `TextAsset`.
508+
509+ ```cs
510+ var asset = Resources.Load<LuaAsset>("example");
511+ await state.DoStringAsync(asset.Text, ct);
512+ ```
513+
514+ ### Resources(Addressables)ModuleLoader
515+
516+ Implementations of ` ILuaModuleLoader ` that utilize either Resources or Addressables internally are also provided.
517+
518+ ``` cs
519+ // Use Resources for module loading
520+ state .ModuleLoader = new ResourcesModuleLoader ();
521+
522+ // Use Addressables for module loading (requires the Addressables package)
523+ state .ModuleLoader = new AddressablesModuleLoader ();
524+ ```
525+
490526## Compatibility
491527
492528Lua-CSharp is designed with integration into .NET in mind, so there are several differences from the C implementation.
0 commit comments