Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Godfrey_GC · Nov 19, 2014 at 05:35 PM · iosresources

Resources.LoadAsync cannot be used in iOS

I want to load resources async when my game is running. So I decide to use Resources.LoadAsync.

Actually, It works well in Editor Mode. But when I get to build iOS, one error comes out.

  1. I tried to delete this sentence Resources.LoadAsync and it built well. Then I added this sentence and this error came out again.

  2. I tried to build Android from my PC, and it's OK. I can also run it in Editor Mode. This error only occurs when building iOS.

  3. I tried to upgrade my Unity from 4.5.4 to 4.5.5, but this error is still there.

I find nobody who met the same problem before, so I have to get there and ask you guys.

I would appreciate any help. Thanks for your time.

my code is like this:

 using UnityEngine;
 using System.Collections;
 
 public class ExampleClass : MonoBehaviour {
     void Start() {
         StartCoroutine(LoadTexture());
     }
     IEnumerator LoadTexture() {
         GameObject go = GameObject.CreatePrimitive(PrimitiveType.Cube);
         ResourceRequest request = Resources.LoadAsync<Texture2D>("glass");
         yield return request;
         go.renderer.material.mainTexture = request.asset;
     }
 }

and when I build iOS, this error comes out:

Cross compilation job Assembly-CSharp.dll failed. UnityEngine.UnityException: Failed AOT cross compiler: /Applications/Unity/Unity.app/Contents/PlaybackEngines/iOSSupport/Tools/OSX/mono-xcompiler --aot=full,asmonly,nodebug,static,outfile="Assembly-CSharp.dll.s" "Assembly-CSharp.dll" current dir : /Users/xxxx/Desktop/ParkourX/Parkour/Temp/StagingArea/Data/Managed Env: Apple_PubSub_Socket_Render = '/tmp/launch-CawMnu/Render' LOGNAME = 'xxxx' __CHECKFIX1436934 = '1' MONO_PATH = '/Users/xxxx/Desktop/ParkourX/Parkour/Temp/StagingArea/Data/Managed' TMPDIR = '/var/folders/bn/ts33w4bs0sz9gtnyqwxf99_c0000gn/T/' USER = 'xxxx' SSH_AUTH_SOCK = '/tmp/launch-iXaAd5/Listeners' GC_DONT_GC = 'yes please' SHELL = '/bin/bash' __CF_USER_TEXT_ENCODING = '0x1F5:0:0' GAC_PATH = '/Users/xxxx/Desktop/ParkourX/Parkour/Temp/StagingArea/Data/Managed' HOME = '/Users/xxxx' PATH = '/usr/bin:/bin:/usr/sbin:/sbin' result file exists: False. Timed out: False stdout: stderr:

at UnityEditor.MonoProcessUtility.RunMonoProcess (System.Diagnostics.Process process, System.String name, System.String resultingFile) [0x00000] in unknown>:0 at UnityEditor.MonoCrossCompile.CrossCompileAOT (BuildTarget target, System.String crossCompilerAbsolutePath, System.String assembliesAbsoluteDirectory, CrossCompileOptions crossCompileOptions, System.String input, System.String output, System.String additionalOptions) [0x00000] in :0 at UnityEditor.MonoCrossCompile+JobCompileAOT.ThreadPoolCallback (System.Object threadContext) [0x00000] in :0 UnityEditor.HostView:OnGUI() Click to expand...

Error building Player: UnityException: Cross compilation failed.

If I delete this two sentences, like this below, it works through building iOS:

 using UnityEngine;
 using System.Collections;
 
 public class ExampleClass : MonoBehaviour {
     void Start() {
         StartCoroutine(LoadTexture());
     }
     IEnumerator LoadTexture() {
         GameObject go = GameObject.CreatePrimitive(PrimitiveType.Cube);
         /*ResourceRequest request = Resources.LoadAsync<Texture2D>("glass");
         yield return request;*/
         yield return null;
         //go.renderer.material.mainTexture = request.asset;
     }
 }


Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Graham-Dunnett ♦♦ · Nov 19, 2014 at 05:36 PM 0
Share

As I said on the forum, I wonder if you do not have iOS Pro. LoadAsync needs Pro.

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by UnityGod · Nov 22, 2014 at 07:53 PM

Hi, today I had the same problem and I have figured out that if I use non-generic version of the method LoadAsync, i.e. call Resources.LoadAsync("glass"), this fixes the problem and doesn't produce the cross-compilation error. Also note, that most probably you have stripping level set in your build settings, because I have this error only when stripping is something different from "Disabled".

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Implement Apple TV ODR (On Demand Resources)? 1 Answer

Memory problem. How do I dump a Streaming Asset from memory? 1 Answer

Why a 109kb .png file teakes 8mb in unity? 1 Answer

iOS - Resources.LoadAsync is VERY slow on older iPads 0 Answers

Loading a Random Resource in a Folder Without Using Resources.LoadAll 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges