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
0
Question by firestoke · Nov 20, 2015 at 11:31 AM · c#ioscrashtextmesh

App Crashes while creating a TextMesh game object in iOS device

I have a function that will create a game object with TextMesh component dynamically, the code is as the following:

 // this will create a TextMesh game object in the passed parent transform
 public static FlyingText getInstanceWithTextMesh(string text, Vector3 pos, int fontSize, Color color, float speed, float duration, Transform parentTransform) {
     pos.z = parentTransform.position.z;
 
     // create game object
     GameObject obj = new GameObject ("FlyingText");
     obj.transform.parent = parentTransform;
     obj.transform.position = pos;
     obj.transform.localScale = new Vector3 (1, 1, 1);
     
     // add TextMesh component
     TextMesh t = obj.AddComponent<TextMesh> (); // !!!!!!!!!! it will crash here !!!!!!!!!!!!!!
     t.text = text;
     t.alignment = TextAlignment.Center;
     t.font = Resources.Load ("Fonts/"+Const.DEFAULT_FONT_NAME) as Font;
     t.fontSize = fontSize;
     t.color = color;
     t.characterSize = 0.1f;
 
     ...
 }

It will crash at this line every time 100%:
TextMesh t = obj.AddComponent ();

Here is the crash log in Xcode: alt text

There is absolutely no problem when I tested in the PC emulator. It only happens in iOS device(Android seems not happen this). One more strange thing, If I insert a TextMesh game object by editor(not by script code) and test again. Then it won't crash any more. I absolutely don't know why.... alt text

Does anyone can help?

BTW, I am using Unity 5.2.1f1 and tested in iPhone 6, iOS 8.3.

gg.png (297.2 kB)
no-crash.jpg (13.1 kB)
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 Jack Yee · May 05, 2016 at 12:18 PM 0
Share

Hi there,

I got hit with this crash as well with Unity 5.3.4 patch 5 and found your report. I submitted a bug report and gave them a sample project to Unity. They were able to reproduce and added that it is only affected when using IL2CPP backend.

Thanks.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Seed_user · May 11, 2016 at 08:18 AM

@firestoke -- got a reply back from Unity and not sure if this applies to you but it involves IL2CPP and code stripping.

My sample project sent to them involved nothing but a MonoBehaviour adding a TextMesh component in the Start() method. I built the sample with IL2CPP backend and code stripping enabled. Their code stripping routines determined that I didn't use that component as they don't scan source to determine what components you need.

Here's his suggestions for fixing (option 3 is my preferred choice):

We have three possible work arounds for this issue:

  1. You can disable the "Strip Engine Code" option. This will increase the size of the output binary, but it is the simplest work around.

  2. You can add a MeshRenderer component to a dummy game object in a scene which is part of the build. This will prevent the MeshRenderer component from being stripped.

You can use a link.xml file to tell the code stripping system to preserve the MeshRenderer component. This link.xml file worked for me:

 <linker>
     <assembly fullname="UnityEngine">
        <type fullname="UnityEngine.MeshRenderer" preserve="all"/>
     </assembly>
 </linker>

More details about the link.xml file are available here: http://docs.unity3d.com/Manual/iphone-playerSizeOptimization.html

Hope that helps.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

C# and JavaScript Unstable? 1 Answer

Distribute terrain in zones 3 Answers

WebCamTexture IOS crashing? 1 Answer

EDITED rend.material change too hard to handle for iOS 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