| | 1 | | using UnityEngine; |
| | 2 | | using UnityEngine.Networking; |
| | 3 | |
|
| | 4 | | namespace DCL |
| | 5 | | { |
| | 6 | | /// <summary> |
| | 7 | | /// Our custom implementation of the UnityWebRequestAssetBundle. |
| | 8 | | /// </summary> |
| | 9 | | public class WebRequestAssetBundle : IWebRequestAssetBundle |
| | 10 | | { |
| | 11 | | private bool useHash = false; |
| | 12 | | private Hash128 hash; |
| | 13 | |
|
| | 14 | | public void SetHash(Hash128 hash) |
| | 15 | | { |
| 27 | 16 | | useHash = true; |
| 27 | 17 | | this.hash = hash; |
| 27 | 18 | | } |
| | 19 | |
|
| | 20 | | public UnityWebRequest CreateWebRequest(string url) |
| | 21 | | { |
| 27 | 22 | | if (useHash) |
| 27 | 23 | | return UnityWebRequestAssetBundle.GetAssetBundle(url, hash); |
| | 24 | | else |
| 0 | 25 | | return UnityWebRequestAssetBundle.GetAssetBundle(url); |
| | 26 | | } |
| | 27 | | } |
| | 28 | | } |