public void saveOutDataAsJSON() { string path = null; #if UNITY_EDITOR path = "Assets/Resources/OutputData/"; #endif #if !UNITY_STANDALONE path = "MyGame_Data/Resources/"; #endif path += saveAssetName + ".json"; SerializableTextureData data = new SerializableTextureData(); data.width = deserializedInputTextureData.width; data.height = deserializedInputTextureData.height; data.data = outputValuesData; string json = JsonUtility.ToJson(data); using (FileStream fs = new FileStream(path, FileMode.Create)) { using (StreamWriter writer = new StreamWriter(fs)) { writer.Write(json); } } #if UNITY_EDITOR UnityEditor.AssetDatabase.Refresh(); #endif }
// Use this for initialization void Start() { deserializedInputTextureData = JsonUtility.FromJson <SerializableTextureData>(inputTextureData.text); computeShader = Resources.Load <ComputeShader>("Shaders/ComputeShader1"); if (computeShader == null) { Debug.LogError("computeShader not found in the specified path"); } else { compute(); } }