AssetBundles not loading from ftp on Android

Hi i need help with my AssetBundles i dont know where is problem i loading it from FTP in editor works fine with unity Remote too if i build&run it is not working i testing it for 3days and without point.That is my first project using AssetBundle because i need sending data to it after build aim confused what aim doing wrong i try build assetbundle using AssetBundleBrowser with script too and before webrequest i try LoadFromCacheOrDownload all working with same issue i using crossdomain.xml on my ftp

thats my testingscript

using UnityEngine;
using UnityEngine.Networking;
using System.Collections;
using TMPro;

public class test : MonoBehaviour
{
    public string assetName;
    public TMP_FontAsset _fontAsset;

    void Start()
    {
        StartCoroutine(DownloadAsset());
    }
    IEnumerator DownloadAsset()
    {
        using (UnityWebRequest uwr = UnityWebRequestAssetBundle.GetAssetBundle("ftp://ftp:password@domainip/AssetBundles/Android/buttonbundle-Android"))

        {
            yield return uwr.SendWebRequest();

            if (uwr.result == UnityWebRequest.Result.ConnectionError || uwr.result == UnityWebRequest.Result.ProtocolError)
            {
                Debug.Log(uwr.error);
            }
            else
            {
                // Get downloaded asset bundle
                AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(uwr);
                var prefab = bundle.LoadAllAssets();
                GameObject content = GameObject.Find("Content");
                foreach(GameObject button in prefab)
                {
                    var go = Instantiate(button, content.transform);
                    go.transform.SetParent(content.transform);
                   
                    foreach(TextMeshProUGUI tmpro in go.GetComponentsInChildren<TextMeshProUGUI>())
                    {
                        tmpro.font = _fontAsset;
                        //tmpro.fontSize = 20f;
                    }
                }
            }
        }
    }
}

thats my assetBundle build script:

using UnityEditor;
using System.IO;
using UnityEngine;

public class CreateAssetBundles
{

    public static string assetBundleDirectory = "Assets/AssetBundles/";

    [MenuItem("Assets/Build AssetBundles")]
    static void BuildAllAssetBundles()
    {

        //if main directory doesnt exist create it
        if (Directory.Exists(assetBundleDirectory))
        {
            Directory.Delete(assetBundleDirectory, true);
        }

        Directory.CreateDirectory(assetBundleDirectory);

        //create bundles for all platform (use IOS for editor support on MAC but must be on IOS build platform)
        BuildPipeline.BuildAssetBundles(assetBundleDirectory, BuildAssetBundleOptions.None, BuildTarget.iOS);
        AppendPlatformToFileName("IOS");
        Debug.Log("IOS bundle created...");

        BuildPipeline.BuildAssetBundles(assetBundleDirectory, BuildAssetBundleOptions.None, BuildTarget.Android);
        AppendPlatformToFileName("Android");
        Debug.Log("Android bundle created...");

        RemoveSpacesInFileNames();

        AssetDatabase.Refresh();
        Debug.Log("Process complete!");
    }

    static void RemoveSpacesInFileNames()
    {
        foreach (string path in Directory.GetFiles(assetBundleDirectory))
        {
            string oldName = path;
            string newName = path.Replace(' ', '-');
            File.Move(oldName, newName);
        }
    }

    static void AppendPlatformToFileName(string platform)
    {
        foreach (string path in Directory.GetFiles(assetBundleDirectory))
        {
            //get filename
            string[] files = path.Split('/');
            string fileName = files[files.Length - 1];

            //delete files we dont need
            if (fileName.Contains(".") || fileName.Contains("Bundle"))
            {
                File.Delete(path);
            }
            else if (!fileName.Contains("-"))
            {
                //append platform to filename
                FileInfo info = new FileInfo(path);
                info.MoveTo(path + "-" + platform);
            }
        }
    }
}

my crossdomain.xml:

<?xml version="1.0"?>
<cross-domain-policy>
<allow-access-from domain="ftp://myftp:pass@domainip/"/>
<allow-access-from domain="http://www.virtualcaffe.sk"/>
</cross-domain-policy>

Either use logcat or find an asset that lets you view the console on your device so you can check for errors.

This exactly. And if you don’t see any obvious exceptions (such as an SSL cert error), then start instrumenting your code.

What is often happening in these cases is one of the following:

  • the code you think is executing is not actually executing at all
  • the code is executing far EARLIER or LATER than you think
  • the code is executing far LESS OFTEN than you think
  • the code is executing far MORE OFTEN than you think
  • the code is executing on another GameObject than you think it is

To help gain more insight into your problem, I recommend liberally sprinkling Debug.Log() statements through your code to display information in realtime.

Doing this should help you answer these types of questions:

  • is this code even running? which parts are running? how often does it run? what order does it run in?
  • what are the values of the variables involved? Are they initialized? Are the values reasonable?
  • are you meeting ALL the requirements to receive callbacks such as triggers / colliders (review the documentation)

Knowing this information will help you reason about the behavior you are seeing.

You can also put in Debug.Break() to pause the Editor when certain interesting pieces of code run, and then study the scene

You could also just display various important quantities in UI Text elements to watch them change as you play the game.

If you are running a mobile device you can also view the console output. Google for how on your particular mobile target.

Here’s an example of putting in a laser-focused Debug.Log() and how that can save you a TON of time wallowing around speculating what might be going wrong:

https://discussions.unity.com/t/839300/3

thanks for replies i try logcat and without error i spread Debug.log() in code too but if i debugging in device with tmpro gameobject i get unknown network error i decide for using google drive and code run clean.Something is wrong with ftp communication and i dont have skill for that ,its too deep for my unity skills and my first project using unity.networking

Maybe the problem is because it’s a direct FTP access? Did you try loading the file from a normal HTTP server instead?

I try it but it not working