Search Unity

Question Best Way to receive AssetBundle Files through TcpClient

Discussion in 'Multiplayer' started by Insightful_Designer, Feb 24, 2023.

  1. Insightful_Designer

    Insightful_Designer

    Joined:
    Jul 28, 2022
    Posts:
    19
    I want to receive AssetBundle files during runtime, so I do it asynchronously
    with NetworkStream.ReadAsync ( buffer, 0, bytesToRead);


    1
    I want to receive an AssetBundle file of 1 MB.
    Would it be better to have a buffer of say 8 KB, receive that and save it to the
    big FinalByteArray which has size 1 MB or directly receive to FinalByteArray
    like that NetworkStream.ReadAsync ( FinalByteArray, 0, bytesToRead);

    2
    Also, I will use AssetBundle.LoadFromMemoryAsync(FinalByteArray);
    which means the 'AssetBundle.LoadFromMemoryAsync' method will take the WHOLE 1 MB array.
    I did not find anywhere specifications on
    how big of a byteArray 'AssetBundle.LoadFromMemoryAsync' method can handle.
    In Unity3d docs, it has one example on which 'AssetBundle.LoadFromMemoryAsync' method takes 1 KB byteArray.
     
  2. ep1s0de

    ep1s0de

    Joined:
    Dec 24, 2015
    Posts:
    168
    AssetBundle.LoadFromMemoryAsync it is limited only by the available RAM, but I saw somewhere that people complained about bundles larger than 4 GB (either they did not load or they loaded but with errors)