示例#1
0
    public Entity CreateAdditionalEntity(GameObject go)
    {
        #if DETAIL_MARKERS
        using (m_CreateAdditional.Auto())
        #endif
        {
            if (go == null)
            {
                throw new ArgumentException("CreateAdditionalEntity must be called with a valid GameObject");
            }

            var instanceID = go.GetInstanceID();
            int index;
            if (m_GameObjectToEntity.TryGetValue(instanceID, out index))
            {
                int count  = m_Entities.CountLinkedList(index);
                var entity = CreateEntity(go, count);
                AddAdditional(index, entity);

                return(entity);
            }
            else
            {
                if (IsPrefab(go))
                {
                    throw new ArgumentException($"CreateAdditionalEntity(GameObject '{go.name}') is a prefab that was not declared for conversion. Did you forget to declare it using IDeclarePrefabReferences or a [UpdateInGroup(typeof(GameObjectConversionDeclarePrefabsGroup))] system. It will be ignored.");
                }
                else
                {
                    throw new ArgumentException($"CreateAdditionalEntity(GameObject '{go.name}') is a game object that was not included in the conversion. It will be ignored.");
                }
            }
        }
    }