Skip to content

Commit dec7a58

Browse files
Update Unity sample
1 parent 1633752 commit dec7a58

38 files changed

+39
-36
lines changed

readme/BlazorServerApp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ The [project file](/samples/BlazorServerApp/BlazorServerApp.csproj) looks like t
6868
<PrivateAssets>all</PrivateAssets>
6969
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
7070
</PackageReference>
71-
<PackageReference Include="Pure.DI.MS" Version="2.1.53" />
71+
<PackageReference Include="Pure.DI.MS" Version="2.1.54" />
7272
</ItemGroup>
7373

7474
</Project>

readme/BlazorWebAssemblyApp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ The [project file](/samples/BlazorWebAssemblyApp/BlazorWebAssemblyApp.csproj) lo
6767
<PrivateAssets>all</PrivateAssets>
6868
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
6969
</PackageReference>
70-
<PackageReference Include="Pure.DI.MS" Version="2.1.53" />
70+
<PackageReference Include="Pure.DI.MS" Version="2.1.54" />
7171
</ItemGroup>
7272

7373
</Project>

readme/GrpcService.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ The [project file](/samples/GrpcService/GrpcService.csproj) looks like this:
5353
<PrivateAssets>all</PrivateAssets>
5454
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
5555
</PackageReference>
56-
<PackageReference Include="Pure.DI.MS" Version="2.1.53" />
56+
<PackageReference Include="Pure.DI.MS" Version="2.1.54" />
5757
</ItemGroup>
5858

5959
</Project>

readme/Maui.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ The [project file](/samples/MAUIApp/MAUIApp.csproj) looks like this:
216216
<PrivateAssets>all</PrivateAssets>
217217
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
218218
</PackageReference>
219-
<PackageReference Include="Pure.DI.MS" Version="2.1.53" />
219+
<PackageReference Include="Pure.DI.MS" Version="2.1.54" />
220220
</ItemGroup>
221221

222222
</Project>

readme/MinimalWebAPI.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ The [project file](/samples/WebAPI/WebAPI.csproj) looks like this:
7676
<PrivateAssets>all</PrivateAssets>
7777
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
7878
</PackageReference>
79-
<PackageReference Include="Pure.DI.MS" Version="2.1.53" />
79+
<PackageReference Include="Pure.DI.MS" Version="2.1.54" />
8080
</ItemGroup>
8181

8282
</Project>

readme/Unity.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ This example demonstrates the creation of a [Unity](https://unity.com/) applicat
66

77
![Unity](https://cdn.sanity.io/images/fuvbjjlp/production/01c082f3046cc45548249c31406aeffd0a9a738e-296x100.png)
88

9-
The definition of the composition is in [Composition.cs](/samples/UnityApp/Assets/Scripts/Composition.cs). This class setups how the composition of objects will be created for the application. You must not forget to define any necessary composition builders:
9+
The definition of the composition is in [Composition.cs](/samples/UnityApp/Assets/Scripts/Composition.cs). This class setups how the composition of objects will be created for the application. Don't forget to define builders for types inherited from `MonoBehaviour`:
1010

1111
```csharp
1212
using Pure.DI;
13+
using UnityEngine;
1314
using static Pure.DI.Lifetime;
1415

1516
internal partial class Composition
@@ -18,7 +19,7 @@ internal partial class Composition
1819

1920
private void Setup() => DI.Setup()
2021
.Bind().As(Singleton).To<ClockService>()
21-
.Builder<Clock>();
22+
.Builders<MonoBehaviour>();
2223
}
2324
```
2425

@@ -28,7 +29,7 @@ Advantages over classical DI container libraries:
2829
- Does not add dependencies to any additional assembly.
2930
- Since the generated code uses primitive language constructs to create object compositions and does not use any libraries, you can easily debug the object composition code as regular code in your application.
3031

31-
The `BuildUp` composition method will be generated for each call to the `Builder<T>()` method when setting up the dependency graph. Its name can be overridden as desired. This method will look like this:
32+
For types inherited from `MonoBehaviour`, a `BuildUp` composition method will be generated. This method will look as follows:
3233

3334
```csharp
3435
[CompilerServices.MethodImpl(MethodImplOptions.AggressiveInlining)]

readme/UnityPageTemplate.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ This example demonstrates the creation of a [Unity](https://unity.com/) applicat
66

77
![Unity](https://cdn.sanity.io/images/fuvbjjlp/production/01c082f3046cc45548249c31406aeffd0a9a738e-296x100.png)
88

9-
The definition of the composition is in [Composition.cs](/samples/UnityApp/Assets/Scripts/Composition.cs). This class setups how the composition of objects will be created for the application. You must not forget to define any necessary composition builders:
9+
The definition of the composition is in [Composition.cs](/samples/UnityApp/Assets/Scripts/Composition.cs). This class setups how the composition of objects will be created for the application. Don't forget to define builders for types inherited from `MonoBehaviour`:
1010

1111
```csharp
1212
using Pure.DI;
13+
using UnityEngine;
1314
using static Pure.DI.Lifetime;
1415

1516
internal partial class Composition
@@ -18,7 +19,7 @@ internal partial class Composition
1819

1920
private void Setup() => DI.Setup()
2021
.Bind().As(Singleton).To<ClockService>()
21-
.Builder<Clock>();
22+
.Builders<MonoBehaviour>();
2223
}
2324
```
2425

@@ -28,7 +29,7 @@ Advantages over classical DI container libraries:
2829
- Does not add dependencies to any additional assembly.
2930
- Since the generated code uses primitive language constructs to create object compositions and does not use any libraries, you can easily debug the object composition code as regular code in your application.
3031

31-
The `BuildUp` composition method will be generated for each call to the `Builder<T>()` method when setting up the dependency graph. Its name can be overridden as desired. This method will look like this:
32+
For types inherited from `MonoBehaviour`, a `BuildUp` composition method will be generated. This method will look as follows:
3233

3334
```csharp
3435
[CompilerServices.MethodImpl(MethodImplOptions.AggressiveInlining)]

readme/WebAPI.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ The [project file](/samples/WebAPI/WebAPI.csproj) looks like this:
5555
<PrivateAssets>all</PrivateAssets>
5656
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
5757
</PackageReference>
58-
<PackageReference Include="Pure.DI.MS" Version="2.1.53" />
58+
<PackageReference Include="Pure.DI.MS" Version="2.1.54" />
5959
</ItemGroup>
6060

6161
</Project>

readme/WebApp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ The [project file](/samples/WebApp/WebApp.csproj) looks like this:
5555
<PrivateAssets>all</PrivateAssets>
5656
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
5757
</PackageReference>
58-
<PackageReference Include="Pure.DI.MS" Version="2.1.53" />
58+
<PackageReference Include="Pure.DI.MS" Version="2.1.54" />
5959
</ItemGroup>
6060

6161
</Project>

samples/UnityApp/Assembly-CSharp-Editor.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
<ImplicitlyExpandDesignTimeFacades>false</ImplicitlyExpandDesignTimeFacades>
4242
</PropertyGroup>
4343
<ItemGroup>
44-
<Analyzer Include="C:\Projects\DevTeam\Pure.DI\samples\UnityApp\Assets\Packages\Pure.DI.2.1.53\analyzers\dotnet\roslyn4.3\cs\Pure.DI.Core.dll" />
45-
<Analyzer Include="C:\Projects\DevTeam\Pure.DI\samples\UnityApp\Assets\Packages\Pure.DI.2.1.53\analyzers\dotnet\roslyn4.3\cs\Pure.DI.dll" />
44+
<Analyzer Include="C:\Projects\DevTeam\Pure.DI\samples\UnityApp\Assets\Packages\Pure.DI.2.1.54\analyzers\dotnet\roslyn4.3\cs\Pure.DI.Core.dll" />
45+
<Analyzer Include="C:\Projects\DevTeam\Pure.DI\samples\UnityApp\Assets\Packages\Pure.DI.2.1.54\analyzers\dotnet\roslyn4.3\cs\Pure.DI.dll" />
4646
<Analyzer Include="C:\Program Files\Unity\Hub\Editor\6000.0.35f1\Editor\Data\Tools\Unity.SourceGenerators\Unity.SourceGenerators.dll" />
4747
<Analyzer Include="C:\Program Files\Unity\Hub\Editor\6000.0.35f1\Editor\Data\Tools\Unity.SourceGenerators\Unity.Properties.SourceGenerator.dll" />
4848
<Analyzer Include="C:\Program Files\Unity\Hub\Editor\6000.0.35f1\Editor\Data\Tools\Unity.SourceGenerators\Unity.UIToolkit.SourceGenerator.dll" />

0 commit comments

Comments
 (0)