Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by da_chinese · Oct 05, 2011 at 01:57 PM · genericscompilationtemplateaotjit

Templates/Generic - AOT problems

Hi,

I ran into some problem using generics/templates in Unity while deploying my code to iPad.

Here is some simple code :

 using UnityEngine;"
 using System.Collections;
 using System.Collections.Generic;
 
 class TestValue<T>
 {
     public T _value;
     
     public TestValue(T _p) 
     {
         _value = _p;
     }
 }
 
 class TestDictonary<T>
 {
     public Dictionary< TestValue<T>, int> _dic;
     
     public TestDictonary(T _p) 
     {
         _dic = new Dictionary<TestValue<T>, int>();
         _dic.Add(new TestValue<T>(_p), 2);
     }
     
     public void PrintAll()
     {
         Debug.Log( _dic.Values.Count );
     }
 }
 
 public class TestLogging : MonoBehaviour 
 {
     void Awake()
     {
         TestDictonary<string> myDictionary = new TestDictonary<string>("Yep");        
         myDictionary.PrintAll();
     }
 }

While running this on my iPad i got:

ExecutionEngineException: Attempting to JIT compile method 'System.Collections.Generic.Dictionary`2 int>:.ctor ()' while running with > --aot-only.

I have done some research and it seems a common problem ( http://ios.xamarin.com/Documentation/Limitations )

What I dont get is how could I discover that before (ie not at runtime) ? Why is there no errors reported during compilation ?

The compilation under unity is done with the flag --aot=full ... so why such cases aren't be discovered there ?

Here is the Unity command line i had discovered in the logs - note how AOT is set to full.

AOT cross compiler: /Applications/Unity.app/Contents/BuildTargetTools/iPhonePlayer/mono-xcompiler --debug --aot=full,asmonly,write-symbols,soft-debug,static,outfile="Assembly-CSharp.dll.s" "Assembly-CSharp.dll" current dir : /Users/XXXX/Dev/Unity/TestLogging/Temp/StagingArea/Data/Managed

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 da_chinese · Oct 06, 2011 at 06:47 AM 0
Share

Thoughts anyone ?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by KvanteTore · Oct 06, 2011 at 10:21 AM

Actually, according to the limitations document you referenced it looks like it should work, as your TestValue is a reference type and not a value type.

However, you could try providing your own IEqualityComparer to the dictionary constructor and see if that helps.

Unfortunately, I have not been able to find a reliable way of determining if a piece of code code will run on iOS without actually uploading the app and running it.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Unity compilation process - JIT and AOT? 1 Answer

iOS JIT compile error on Generic method called with basic types (int, bool, float) 1 Answer

How does Unity compilation work? 1 Answer

generic / templatized components / monobehaviors ? 0 Answers

ExecutionEngineException : JIT/AOT error when adding to delegate 1 Answer


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