Skip to content

Commit

Permalink
Use RegisterComponent* constraint Component
Browse files Browse the repository at this point in the history
  • Loading branch information
hadashiA committed Jan 28, 2021
1 parent 03aca75 commit 5091d39
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public sealed class ComponentRegistrationBuilder : RegistrationBuilder
string gameObjectName;
Component prefab;

internal ComponentRegistrationBuilder(
ComponentRegistrationBuilder(
Type implementationType,
Lifetime lifetime,
List<Type> interfaceTypes = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ public ComponentsBuilder(IContainerBuilder containerBuilder)
public RegistrationBuilder AddInstance(MonoBehaviour component)
=> containerBuilder.RegisterComponent(component);

public RegistrationBuilder AddInHierarchy<T>() where T : MonoBehaviour
public RegistrationBuilder AddInHierarchy<T>() where T : Component
=> containerBuilder.RegisterComponentInHierarchy<T>();

public ComponentRegistrationBuilder AddOnNewGameObject<T>(Lifetime lifetime, string newGameObjectName = null)
where T : MonoBehaviour
where T : Component
=> containerBuilder.RegisterComponentOnNewGameObject<T>(lifetime, newGameObjectName);

public ComponentRegistrationBuilder AddInNewPrefab<T>(T prefab, Lifetime lifetime)
where T : MonoBehaviour
where T : Component
=> containerBuilder.RegisterComponentInNewPrefab(prefab, lifetime);
}

Expand Down Expand Up @@ -115,7 +115,7 @@ public static ComponentRegistrationBuilder RegisterComponentOnNewGameObject<T>(
this IContainerBuilder builder,
Lifetime lifetime,
string newGameObjectName = null)
where T : MonoBehaviour
where T : Component
{
var registrationBuilder = new ComponentRegistrationBuilder(
newGameObjectName,
Expand All @@ -129,7 +129,7 @@ public static ComponentRegistrationBuilder RegisterComponentInNewPrefab<T>(
this IContainerBuilder builder,
T prefab,
Lifetime lifetime)
where T : MonoBehaviour
where T : Component
{
var registrationBuilder = new ComponentRegistrationBuilder(
prefab,
Expand Down
2 changes: 1 addition & 1 deletion VContainer/Packages/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"com.unity.entities": "0.11.1-preview.4",
"com.unity.ide.rider": "2.0.7",
"com.unity.ide.visualstudio": "2.0.5",
"com.unity.test-framework": "1.1.19",
"com.unity.test-framework": "1.1.20",
"com.unity.ugui": "1.0.0",
"nuget.mono-cecil": "0.1.6-preview",
"com.unity.modules.animation": "1.0.0",
Expand Down
6 changes: 3 additions & 3 deletions VContainer/Packages/packages-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"url": "https://packages.unity.com"
},
"com.unity.ext.nunit": {
"version": "1.0.5",
"version": "1.0.6",
"depth": 1,
"source": "registry",
"dependencies": {},
Expand Down Expand Up @@ -144,11 +144,11 @@
"url": "https://packages.unity.com"
},
"com.unity.test-framework": {
"version": "1.1.19",
"version": "1.1.20",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.ext.nunit": "1.0.5",
"com.unity.ext.nunit": "1.0.6",
"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0"
},
Expand Down

0 comments on commit 5091d39

Please sign in to comment.