Ejemplo n.º 1
0
        void OnAddDataBuilder(Rect buttonRect, ReorderableList list)
        {
            var assetPath = EditorUtility.OpenFilePanelWithFilters("Data Builder", "Assets", new[] { "Data Builder", "asset" });

            if (string.IsNullOrEmpty(assetPath))
            {
                return;
            }
            var builder = AssetDatabase.LoadAssetAtPath <ScriptableObject>(assetPath.Substring(assetPath.IndexOf("Assets/")));

            if (!typeof(IDataBuilder).IsAssignableFrom(builder.GetType()))
            {
                Debug.LogWarningFormat("Asset at {0} does not implement the IDataBuilder interface.", assetPath);
                return;
            }
            m_AasTarget.AddDataBuilder(builder as IDataBuilder);
        }