Mail.ruПочтаМой МирОдноклассникиВКонтактеИгрыЗнакомстваНовостиКалендарьОблакоЗаметкиВсе проекты

Zenject (Unity) как передать сущность который наследуется от MonoBehaviour ???

Межголоктический разум Ученик (193), открыт 11 часов назад
private Lavash select ; // этот класс наследуется от MonoBehaviour

[Inject]
public void Construct(Lavash _select)
{
select = _select;
}

------------------------

Если убрать MonoBehaviour из класса "Lavash " то всё работает. Но мне он нужен
Если не убрать, то такая ошибка:


ZenjectException: Assert hit! Invalid type given during bind command. Expected type 'Lavash' to NOT derive from UnityEngine.Component
ModestTree.Assert.That (System.Boolean condition, System.String message, System.Object p1) (at Assets/Plugins/Zenject/Source/Internal/Assert.cs:347)
Zenject.BindingUtil.AssertIsNotComponent (System.Type type) (at Assets/Plugins/Zenject/Source/Binding/BindingUtil.cs:78)
Zenject.BindingUtil.AssertTypesAreNotComponents (System.Collections.Generic.IEnumerable`1[T] types) (at Assets/Plugins/Zenject/Source/Binding/BindingUtil.cs:117)
Zenject.FromBinder.FromNew () (at Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinder.cs:63)
GameInstaller.InstallBindings () (at Assets/Scripts/GameInstaller.cs:12)
Zenject.Context.InstallInstallers (System.Collections.Generic.List`1[T] normalInstallers, System.Collections.Generic.List`1[T] normalInstallerTypes, System.Collections.Generic.List`1[T] scriptableObjectInstallers, System.Collections.Generic.List`1[T] installers, System.Collections.Generic.List`1[T] installerPrefabs) (at Assets/Plugins/Zenject/Source/Install/Contexts/Context.cs:218)
Zenject.Context.InstallInstallers () (at Assets/Plugins/Zenject/Source/Install/Contexts/Context.cs:139)
Zenject.SceneContext.InstallBindings (System.Collections.Generic.List`1[T] injectableMonoBehaviours) (at Assets/Plugins/Zenject/Source/Install/Contexts/SceneContext.cs:346)
Zenject.SceneContext.Install () (at Assets/Plugins/Zenject/Source/Install/Contexts/SceneContext.cs:265)
Zenject.SceneContext.Validate () (at Assets/Plugins/Zenject/Source/Install/Contexts/SceneContext.cs:121)
Zenject.Internal.ZenUnityEditorUtil.ValidateCurrentSceneSetup () (at Assets/Plugins/Zenject/Source/Editor/ZenUnityEditorUtil.cs:67)
UnityEngine.Debug:LogException(Exception)
ModestTree.Log:ErrorException(Exception) (at Assets/Plugins/Zenject/Source/Internal/Log.cs:60)
Zenject.Internal.ZenUnityEditorUtil:ValidateCurrentSceneSetup() (at Assets/Plugins/Zenject/Source/Editor/ZenUnityEditorUtil.cs:72)
Zenject.Internal.ZenUnityEditorUtil:ValidateAllActiveScenes() (at Assets/Plugins/Zenject/Source/Editor/ZenUnityEditorUtil.cs:96)
Zenject.Internal.<>c:<ValidateAllActiveScenes>b__16_0() (at Assets/Plugins/Zenject/Source/Editor/ZenMenuItems.cs:262)
Zenject.Internal.ZenUnityEditorUtil:SaveThenRunPreserveSceneSetup(Action) (at Assets/Plugins/Zenject/Source/Editor/ZenUnityEditorUtil.cs:26)
Zenject.Internal.ZenMenuItems:ValidateAllActiveScenes() (at Assets/Plugins/Zenject/Source/Editor/ZenMenuItems.cs:260)

__________________________

ZenjectException: Zenject Validation Failed! See errors below for details.
Zenject.Internal.ZenUnityEditorUtil.ValidateCurrentSceneSetup () (at Assets/Plugins/Zenject/Source/Editor/ZenUnityEditorUtil.cs:84)
Zenject.Internal.ZenUnityEditorUtil.ValidateAllActiveScenes () (at Assets/Plugins/Zenject/Source/Editor/ZenUnityEditorUtil.cs:96)
Zenject.Internal.ZenMenuItems+<>c.<ValidateAllActiveScenes>b__16_0 () (at Assets/Plugins/Zenject/Source/Editor/ZenMenuItems.cs:262)
Zenject.Internal.ZenUnityEditorUtil.SaveThenRunPreserveSceneSetup (System.Action action) (at Assets/Plugins/Zenject/Source/Editor/ZenUnityEditorUtil.cs:26)
UnityEngine.Debug:LogException(Exception)
ModestTree.Log:ErrorException(Exception) (at Assets/Plugins/Zenject/Source/Internal/Log.cs:60)
Zenject.Internal.ZenUnityEditorUtil:SaveThenRunPreserveSceneSetup(Action) (at Assets/Plugins/Zenject/Source/Editor/ZenUnityEditorUtil.cs:31)
0 ответов
Похожие вопросы