Save sprite in custom folder

I’m creating an android app with Unity and I have to create a sprite dynamically, save it to a custom folder ( maybe Application.PersistantData ?) because Resources folder is not available.
So here are the different steps of the process :

  1. Take a photo with the camera
  2. Save it to Persistant data folder
  3. Load it and create a sprite with this texture
  4. Save the sprite somewhere (not resources folder, this is my problem. I already did it with AssetDatabase.CreateAsset() but its not available on build).
  5. Set the sprite to a scriptable Object.

Steps 1, 2, 3 and 5 work on build. My problem is step 4.

This is my code (works on editor but not on build because of AssetDatabase.CreateAsset()) :

public class takePhoto : MonoBehaviour {

	// Variables
	WebCamTexture webCamTexture;
	public Character UserObject;
	private Sprite ImageUser;
	private RawImage myTexture;
	private byte[] bytesImage;
	Texture2D thisTexture;
	private RawImage thisImage;
	private Sprite mySprite;
	private SpriteRenderer sr;

	private RawImage test;
	private Sprite last_screenshot_save;

	private Image m_SpriteRenderer;

	private float widthSprite;
	private float heightSprite;
	private float ratio;

	void Start () {
		// Get the front camera on start
		WebCamDevice[] devices = WebCamTexture.devices;
		foreach (WebCamDevice cam in devices) {
			if (!cam.isFrontFacing) continue;
			webCamTexture = new WebCamTexture {deviceName =};
			webCamTexture.Play ();

	public void snapshot()
		// Set file path
		var fileNameResources = "Assets/Resources/userPic.asset";
		var fileNamePersistantData = Application.persistentDataPath + "/userPic.png";
		// Take photo and save it to persistent data folder
		Texture2D photo = new Texture2D (webCamTexture.width, webCamTexture.height);
		photo.SetPixels (webCamTexture.GetPixels ());
		photo.Apply ();

		byte[] bytes = photo.EncodeToPNG ();
		File.WriteAllBytes (fileNamePersistantData, bytes);
		if (System.IO.File.Exists(fileNamePersistantData))
			// Load photo from persistent data folder
			byte[] bytesPNG = System.IO.File.ReadAllBytes(fileNamePersistantData);
			Texture2D texture = new Texture2D(1, 1);
			// var to crop sprite to square
			var floatWidthCam = (float) webCamTexture.width;
			var floatHeightCam = (float) webCamTexture.height;
			widthSprite = (floatWidthCam - floatHeightCam) / 2.0f;
			ratio =  ((float)webCamTexture.width) / ((float)webCamTexture.height);
			// Create square sprite from photo
			mySprite = Sprite.Create(texture, new Rect(widthSprite, 0.0f, (texture.width) / ratio, texture.height), new Vector2(0.5f, 0.5f), 300.0f);	
			// Save the sprite (doesn't work on build)
			AssetDatabase.CreateAsset(mySprite, fileNameResources);
			Sprite t = (Sprite)AssetDatabase.LoadAssetAtPath(fileNameResources, typeof(Sprite));
			// Set the sprite to scriptable object
			UserObject.infos.states[UserObject.stateToUse].image = t;

Can someone help ?

Take a look at this one.