File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
src/NuGetForUnity/Editor/Helper Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,15 @@ internal static Task<Texture2D> DownloadImageAsync([NotNull] string url)
41
41
{
42
42
try
43
43
{
44
+ #if UNITY_2022_1_OR_NEWER
45
+ if ( PlayerSettings . insecureHttpOption == InsecureHttpOption . NotAllowed &&
46
+ url . StartsWith ( "http://" , StringComparison . OrdinalIgnoreCase ) )
47
+ {
48
+ // if insecure http url is not allowed try to use https.
49
+ url = url . Replace ( "http://" , "https://" , StringComparison . OrdinalIgnoreCase ) ;
50
+ }
51
+ #endif
52
+
44
53
var fromCache = false ;
45
54
if ( url . StartsWith ( "file://" , StringComparison . OrdinalIgnoreCase ) )
46
55
{
@@ -53,15 +62,6 @@ internal static Task<Texture2D> DownloadImageAsync([NotNull] string url)
53
62
fromCache = true ;
54
63
}
55
64
56
- #if UNITY_2022_1_OR_NEWER
57
- if ( PlayerSettings . insecureHttpOption == InsecureHttpOption . NotAllowed &&
58
- url . StartsWith ( "http://" , StringComparison . OrdinalIgnoreCase ) )
59
- {
60
- // if insecure http url is not allowed try to use https.
61
- url = url . Replace ( "http://" , "https://" , StringComparison . OrdinalIgnoreCase ) ;
62
- }
63
- #endif
64
-
65
65
var taskCompletionSource = new TaskCompletionSource < Texture2D > ( ) ;
66
66
var request = UnityWebRequest . Get ( url ) ;
67
67
{
You can’t perform that action at this time.
0 commit comments