예제 #1
0
        // Need to do this to ensure that we don't use multiple different prefabs
        // with the same singleton ID
        public void MarkPrefab(SingletonId id, GameObject prefab)
        {
            PrefabMarkInfo markInfo;

            if (_prefabMarks.TryGetValue(id, out markInfo))
            {
                if (markInfo.Prefab != prefab)
                {
                    throw new ZenjectBindException(
                              "Attempted to use multiple different prefabs with ToSinglePrefab using the same type/identifier: '{0}' / '{1}'"
                              .Fmt(id.ConcreteType, id.ConcreteIdentifier));
                }
            }
            else
            {
                markInfo = new PrefabMarkInfo()
                {
                    Prefab = prefab,
                };
                _prefabMarks.Add(id, markInfo);
            }

            markInfo.RefCount += 1;
        }
        // Need to do this to ensure that we don't use multiple different prefabs
        // with the same singleton ID
        public void MarkPrefab(SingletonId id, GameObject prefab)
        {
            PrefabMarkInfo markInfo;

            if (_prefabMarks.TryGetValue(id, out markInfo))
            {
                if (markInfo.Prefab != prefab)
                {
                    throw new ZenjectBindException(
                        "Attempted to use multiple different prefabs with ToSinglePrefab using the same type/identifier: '{0}' / '{1}'"
                        .Fmt(id.ConcreteType, id.ConcreteIdentifier));
                }
            }
            else
            {
                markInfo = new PrefabMarkInfo()
                {
                    Prefab = prefab,
                };
                _prefabMarks.Add(id, markInfo);
            }

            markInfo.RefCount += 1;
        }