Load data made in editor?

Hi, I’m saving some values inside unity editor and only here. But I would like to load them in builded game. Here is full code, it’s working only in editor. I think to use “Resource” folder but have problem with that.

using UnityEngine;
using System.Collections;
using System;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using UnityEngine.UI;

public class testLoadSave : MonoBehaviour {

	public GameObject[] obiekty = new GameObject[5];
	public int slot = 1;
	public Text slotTekst;

	
	// Update is called once per frame
	void Update () {

		for (int i = 0; i < obiekty.Length; i++) {
			if(i > 0)
				obiekty_.transform.RotateAround(obiekty[0].transform.position, Vector3.up, 20 * Time.deltaTime * i);_
  •  }*
    
  • }*

  • public void load()*

  • {*

  •  // how to use resource.Load here ???*
    
  •  BinaryFormatter bf = new BinaryFormatter();*
    
  •  FileStream filo = File.Open("Assets/Resources/" + "test_" + slot, FileMode.Open);*
    
  •  playerDatoso datki = (playerDatoso)bf.Deserialize(filo);*
    
  •  filo.Close ();*
    
  •  for (int i = 0; i < 5; i++) {*
    
  •  	Vector3 posi = new Vector3(0,0,0);*
    

_ posi.x = datki.poziX*;_
_ posi.y = datki.poziY;
posi.z = datki.poziZ;
obiekty.transform.position = posi;
Quaternion roti = new Quaternion(0,0,0,0);
roti.w = datki.rotW;
roti.x = datki.rotX;
roti.y = datki.rotY;
roti.z = datki.rotZ;
obiekty.transform.rotation = roti;
}
}*_

* public void Save()*
* {*
* BinaryFormatter bf = new BinaryFormatter();*
* FileStream filo = File.Create(“Assets/Resources/” + “test_” + slot);*

* playerDatoso datki = new playerDatoso();*

* datki.poziX = new float[5];*
* datki.poziY = new float[5];*
* datki.poziZ = new float[5];*

* datki.rotW = new float[5];*
* datki.rotX = new float[5];*
* datki.rotY = new float[5];*
* datki.rotZ = new float[5];*

* for (int i = 0; i < 5; i++) {*
datki.poziX = obiekty*.transform.position.x;*
datki.poziY = obiekty*.transform.position.y;*
datki.poziZ = obiekty*.transform.position.z;*
datki.rotW = obiekty*.transform.rotation.w;*
datki.rotX = obiekty*.transform.rotation.x;*
datki.rotY = obiekty*.transform.rotation.y;*
datki.rotZ = obiekty*.transform.rotation.z;*
* }*

* bf.Serialize (filo, datki);*
* filo.Close ();*

* }*

* public void Prawo()*
* {*
* slot ++;*
* Klampuj();*
* }*

* public void Lewo()*
* {*
* slot–;*
* Klampuj();*
* }*

* void Klampuj()*
* {*
* slot = Mathf.Clamp(slot, 1, 5);*
* slotTekst.text = slot.ToString();*
* }*
}
[Serializable]
class playerDatoso
{
* public float[] poziX, poziY, poziZ;*
* public float[] rotW, rotX, rotY, rotZ;*
}

Ok finally found the solution, offcourse that was to get just the right one line :stuck_out_tongue:

// so used another variable
private string streamPath;
// then set up this in Start() function
streamPath = Application.streamingAssetsPath;
// an at last in Load() function
FileStream filo = File.Open(streamPath + "/test_" + slot + ".txt", FileMode.Open);
// rest like in my first post

With this I need to create folder StreamingAssets and hold there files I need. Tested in editor, pc and android build.