Пример #1
0
    static internal void ImportSelected()
    {
        string path = UnityEditorExtensions.ShowImportDialog("Import DataNode");

        if (!string.IsNullOrEmpty(path))
        {
            var node = DataNode.Read(path, true);

            if (node != null)
            {
                if (node.GetChild("Prefabs") != null)
                {
                    ComponentSerialization.DeserializeBundle(node);
                }
                else
                {
                    Selection.activeGameObject = node.Instantiate();
                }
            }
            else
            {
                Debug.LogError("Failed to parse " + path + " as DataNode");
            }
        }
    }
Пример #2
0
    static internal void ConvertC()
    {
        string path = UnityEditorExtensions.ShowImportDialog("Convert DataNode");

        if (!string.IsNullOrEmpty(path))
        {
            DataNode node = DataNode.Read(path, true);
            if (node != null)
            {
                Save(node, path, DataNode.SaveType.Compressed);
            }
            else
            {
                Debug.LogError("Failed to parse " + path + " as DataNode");
            }
        }
    }