Exemple #1
0
    void GeneratePrefab(NestedPrefabData prefabData)
    {
        // Debug.Log("NestedPrefab::GeneratePrefab - prefabData " + prefabData.prefabPath + " ");

        Transform parent = GetHierarchyTransform(prefabData.hierarchyPathId);

        GameObject clone = prefabGenerator.GenerateFrom(prefabData.prefabPath);

        if (clone == null)
        {
            Debug.LogError("Error when trying to generate prefab " + prefabData.prefabPath + " !", this);
        }

        clone.transform.parent = parent;

        prefabData.CopyDataTo(clone.transform);

        // Recursive generation
        NestedPrefab nestedPrefab = clone.GetComponent <NestedPrefab>();

        if (nestedPrefab != null)
        {
            nestedPrefab.prefabGenerator = prefabGenerator;
            nestedPrefab.GeneratePrefabs(false); // Avoid to ask permission twice
        }
    }
Exemple #2
0
    void GeneratePrefab(NestedPrefabData prefabData)
    {
        Transform parent = GetHierarchyTransform(prefabData.hierarchyPathId);

        GameObject clone = prefabGenerator.GenerateFrom(prefabData.prefabPath);

        clone.transform.parent = parent;

        prefabData.CopyDataTo(clone.transform);
    }