0

我创建了安装程序,使用脚本创建了一个预制件,然后将其附加到 SceneContext。但是当我运行时出现此错误

“ZenjectException:断言命中!在上下文'SceneContext'的安装程序属性中找到名称为'Installer'的预制件。您应该为此使用属性'InstallerPrefabs'。”

public class DefaultInstaller : MonoInstaller
{
    public override void InstallBindings()
    {
        Container.Bind<IController>().To<RandomNumberController>().AsSingle();
    }
}

有什么建议么?

4

1 回答 1

0

您应该为此使用属性“InstallerPrefabs”

您是否考虑过在InstallerPrefabsSceneContext 的属性中引用您的预制件,而不是属性Installer

SceneContext 的检查器中的第二个列表,而不是第一个:

场景上下文

于 2021-04-22T13:47:09.140 回答