Example #1
0
    public static void SetScriptableData(Type _type)
    {
        //プレハブにスクリプタブルオブジェクトを設置
        UnityEngine.Object[] assets;
        string assetName = SystemSetting.GetResourcesLoadPath() + _type.Name + "Asset";

        assets = Resources.LoadAll(assetName);

        MasterLoadSprite tmp     = new MasterLoadSprite();
        ScriptableObject sObject = null;

        foreach (UnityEngine.Object asset in assets)
        {
            if (asset is MasterLoadSprite)
            {
                tmp     = (MasterLoadSprite)asset;
                sObject = (ScriptableObject)asset;
            }
        }
        List <MasterLoadSprite.Data> listData = MasterLoadSpriteCSVLoader.GetListDataFromCSV(_type);

        tmp.DataList = listData;

        //最後に保存して変更を確定
        EditorUtility.SetDirty(sObject);
    }
Example #2
0
    public static void ObjectCreate()
    {
        MasterLoadSprite loadSettingData = CreateInstance <MasterLoadSprite> ();
        string           path            = SystemSetting.GetScriptableobjectPath() + "MasterLoadSpriteAsset" + ".asset";

        AssetDatabase.CreateAsset(loadSettingData, path);
        AssetDatabase.ImportAsset(path);
        EditorUtility.UnloadUnusedAssets();
    }
Example #3
0
	public static void CreateComponents (Type _type)
	{
		string name = "target";
		string outputPath = SystemSetting.GetAssetSrcPath() + _type.Name + "Prefab.prefab";


		GameObject gameObject = EditorUtility.CreateGameObjectWithHideFlags (
			                          name,
			                          HideFlags.HideInHierarchy,
			typeof(MasterLoadSpriteDataHolder)
		);

		//プレハブにスクリプタブルオブジェクトを設置
		UnityEngine.Object[] assets;

		string assetName = SystemSetting.GetResourcesLoadPath () + _type.Name + "Asset";

		assets = Resources.LoadAll (assetName);
		Debug.LogWarning ("GetObj :" + assetName.ToString ());


		MasterLoadSprite tmp = new MasterLoadSprite();

		foreach (UnityEngine.Object asset in assets) {
			if (asset is MasterLoadSprite) {
				tmp = (MasterLoadSprite)asset;
			}
		}

		MasterLoadSpriteDataHolder holder = gameObject.GetComponent<MasterLoadSpriteDataHolder> ();

		holder.assetBundleData = tmp;
		SetAssetBundleInfo (gameObject);

		PrefabUtility.CreatePrefab (outputPath, gameObject, ReplacePrefabOptions.ReplaceNameBased);
		Editor.DestroyImmediate (gameObject);
	}