Esempio n. 1
0
    void OnEnable()
    {
        editorData = ScriptableObject.CreateInstance <YuME_prefabSamplerData>();
        string[] guids = AssetDatabase.FindAssets("YuME_prefabSamplerSettings");

        if (guids.Length == 0)
        {
            // create a new setting file
            Debug.Log("Yuponic Prefab Sampler: No settings file found. Creating new settings file");
            editorData = ScriptableObject.CreateInstance <YuME_prefabSamplerData>();

            AssetDatabase.CreateAsset(editorData, "Assets/Yuponic/YuME_prefabSamplerSettings.asset");
            AssetDatabase.SaveAssets();

            editorData = AssetDatabase.LoadAssetAtPath("Assets/Yuponic/YuME_prefabSamplerSettings.asset", typeof(YuME_prefabSamplerData)) as YuME_prefabSamplerData;
        }
        else
        {
            // load the settings
            editorData = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(guids[0]), typeof(YuME_prefabSamplerData)) as YuME_prefabSamplerData;
        }

        checkForValidSettings();
    }
Esempio n. 2
0
 void OnEnable()
 {
     editorData = ScriptableObject.CreateInstance <YuME_prefabSamplerData>();
     string[] guids = AssetDatabase.FindAssets("YuME_prefabSamplerSettings");
     editorData = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(guids[0]), typeof(YuME_prefabSamplerData)) as YuME_prefabSamplerData;
 }