• WWW.LoadFromCacheOrDownload


    WWW.LoadFromCacheOrDownload

      static WWW LoadFromCacheOrDownload(string url, int version, uint crc = 0);

      url:Must be '%' escaped.

      version:The file will only be loaded from the disk cache if it has previously been downloaded with the same version parameter. By incrementing the version number requested by your application, you can force Caching to download a new copy of the AssetBunlde from url.

      crc:If this is non-zero, then the content will be compared against the checksum before loading it, and give an error if it does not match. You can use this to avoid data corruption from bad downloads or users tampering with the cached files on disk. If the CRC does not match, Unity will try to redownload the data, and if the CRC on the server does not match it will fail with an error. 

      注意要点:

      Cached AssetBundles are uniquely identified solely by the filename and version number; all domain and path information in url is ignored by Caching. Since cached AssetBundles are identified by filename instead of the full URL, you can change the directory from where the asset bundle is downloaded at any time. This is useful for pushing out new versions of the game and ensuring that files are not cached incorrectly by the browser or by a CDN. For WebPlayer applications that use the shared cache, Caching adds unique identifying information to identically-named AssetBundles in order to prevent name collisions between applications.

      If the cache folder does not have any space for caching additional files, LoadFromCacheOrDownload will iteratively delete the least-recently-used AssetBundles from the Cache until sufficient space is available to store the new AssetBundle. If making space is not possible (because the hard disk is full, or all files in the cache are currently in use), LoadFromCacheOrDownload() will bypass Caching and stream the file into memory like a normal "new WWW()" call

      本条通常不会遇到,基本上不会有磁盘空间不足的情况。

    参考:file:///C:/Program%20Files%20(x86)/Unity/Editor/Data/Documentation/html/en/ScriptReference/WWW.LoadFromCacheOrDownload.html

  • 相关阅读:
    关于TxQBService报的错,腾讯你真牛B啊
    用C#读取txt文件的方法
    Python-Redis的发布与订阅
    Python-连接Redis并操作
    Python-Redis的Set操作
    Python-Redis的List操作
    Python-Redis的Hash操作
    Python-Redis的String操作
    Python-RabbitMQ消息队列实现rpc
    Python-RabbitMQ消息队列的发布与订阅
  • 原文地址:https://www.cnblogs.com/tekkaman/p/4028554.html
Copyright © 2020-2023  润新知