• 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 /
  • Help Room /
avatar image
0
Question by Kostishko · Aug 05, 2021 at 12:57 PM · android buildlistsscript error

AoT lists, and lists which I made with Bolt doesn't work on device, but fine work in Editor.

Hello, I update project to new unity version for publish project in google play, and before that all works fine, and in editor, and on device.

But now all work only in editor, and lists stop working on device. Can someone help me, may be your seen that before?

I took logs from device, and get that exeption:

 08-04 13:25:26.257  7766  7917 W Unity   : Deserialization Failure Data
 08-04 13:25:26.257  7766  7917 W Unity   :
 08-04 13:25:26.257  7766  7917 W Unity   : Object References:
 08-04 13:25:26.257  7766  7917 W Unity   : (None)
 08-04 13:25:26.257  7766  7917 W Unity   :
 08-04 13:25:26.257  7766  7917 W Unity   : JSON:
 08-04 13:25:26.257  7766  7917 W Unity   : {
 08-04 13:25:26.257  7766  7917 W Unity   :     "declarations": {
 08-04 13:25:26.257  7766  7917 W Unity   :         "collection": {
 08-04 13:25:26.257  7766  7917 W Unity   :             "$content": [
 08-04 13:25:26.257  7766  7917 W Unity   :                 {
 08-04 13:25:26.257  7766  7917 W Unity   :                     "name": "BallStrikeSaved",
 08-04 13:25:26.257  7766  7917 W Unity   :                     "value": {
 08-04 13:25:26.257  7766  7917 W Unity   :                         "$content": 0,
 08-04 13:25:26.257  7766  7917 W Unity   :                         "$type": "System.Int32"
 08-04 13:25:26.257  7766  7917 W Unity   :                     },
 08-04 13:25:26.257  7766  7917 W Unity   :                     "$version": "A"
 08-04 13:25:26.257  7766  7917 W Unity   :                 },
 08-04 13:25:26.257  7766  7917 W Unity   :                 {
 08-04 13:25:26.257  7766  7917 W Unity   :                     "name": "ScoreCountSaved",
 08-04 13:25:26.257  7766  7917 W Unity   :                     "value": {
 08-04 13:25:26.257  7766  7917 W Unity   :                         "$content": 0,
 08-04 13:25:26.257  7766  7917 W Unity   :                         "$type": "System.Int32"
 08-04 13:25:26.257  7766  7917 W Unity   :                     },
 08-04 13:25:26.257  7766  7917 W Unity   :                     "$version": "A"
 08-04 13:25:26.257  7766  7917 W Unity   :                 },
 08-04 13:25:26.257  7766  7917 W Unity   :                 {
 08-04 13:25:26.257  7766  7917 W Unity   :                     "name": "RecordsCountList",
 08-04 13:25:26.257  7766  7917 W Unity   :                     "value": null,
 08-04 13:25:26.257  7766  7917 W Unity   :                     "$version": "A"
 08-04 13:25:26.257  7766  7917 W Unity   :                 },
 08-04 13:25:26.257  7766  7917 W Unity   :                 {
 08-04 13:25:26.257  7766  7917 W Unity   :                     "name": "RecordsList",
 08-04 13:25:26.257  7766  7917 W Unity   :                     "value": {
 08-04 13:25:26.257  7766  7917 W Unity   :                         "$content": [
 08-04 13:25:26.257  7766  7917 W Unity   :                             0.0,
 08-04 13:25:26.257  7766  7917 W Unity   :                             0.0,
 08-04 13:25:26.257  7766  7917 W Unity   :
 08-04 13:25:26.287  7766  7917 E Unity   : Failed to deserialize scriptable object.
 08-04 13:25:26.287  7766  7917 E Unity   : System.Runtime.Serialization.SerializationException: Deserialization into 'Bolt.VariablesAsset' failed. ---> System.InvalidOperationException: Constructor of System.Collections.Generic.List`1[System.Single] threw an exception when creating an instance ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'System.Collections.Generic.List<System.Single>' threw an exception. ---> System.ExecutionEngineException: Attempting to call method 'System.Collections.Generic.List`1[[System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]::.cctor' for which no ahead of time (AOT) code was generated.
 08-04 13:25:26.287  7766  7917 E Unity   :   at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <00000000000000000000000000000000>:0
 08-04 13:25:26.287  7766  7917 E Unity   :   at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [
 08-04 13:25:26.446  7766  7917 E Unity   : InvalidOperationException: Variable not found: 'RecordListAot'.
Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Kostishko · Aug 05, 2021 at 09:43 PM

Well, I think I solved this. How I understood - problem was in new SDK Android version. Lists now work with json format (doesn't know how exactle). I found on github packages "Json.NET 10.0.3 for Unity" and add to project (just in files, not on scenes) c# script. All it's working now:

 using Newtonsoft.Json.Utilities;
 using UnityEngine;
 
 public class AotTypeEnforcer : MonoBehaviour
 {
     public void Awake()
     {
         AotHelper.EnsureList<int>();
     }
 }
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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

172 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Scripts works on PC, not android. 0 Answers

App crashes right after splash screen 0 Answers

Problem with CommandInvokationFailure: Android Asset Packaging Tool Failed. 1 Answer

AndroidManifest-main.xml merging error 2017.1.1f1 0 Answers

Hey, i have this error, help.. 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