I’ve stuck and don’t know what to do.
I’m using really simple code to load external image into game. Here is a test script I’ve made to load image and display it on screen:
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
public class LoadImage : MonoBehaviour
{
[SerializeField] private string _url;
private void OnEnable()
{
StartCoroutine(LoadTexture());
}
private IEnumerator LoadTexture()
{
var uwr = UnityWebRequestTexture.GetTexture(_url);
yield return uwr.SendWebRequest();
var image = gameObject.GetComponent<Image>();
var texture = ((DownloadHandlerTexture) uwr.downloadHandler).texture;
image.sprite = Sprite.Create(texture, new Rect(0f, 0f, texture.width, texture.height), new Vector2(0.5f, 0.5f));
}
}
Everything works fine, but in Safari image is not loading. It’s not even sending request to load it.
JS Console output:
I’ve disabled prevent cross-site tracking in Safari setting and it works. But unfortunately be default this option is on.
I just checked and found out that it works if I open applications on my site, but it doesn’t work when I try to download my application in iframe on another site (from my site), is there any solution?