Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 /
  • Help Room /
avatar image
0
Question by SamuelRousseaux · Oct 18, 2017 at 09:27 AM · iosiphonelerpipad

Texture tilling problem on iOS

Hi ! I'm currently coding a game with my team, and we have a strange problem.

At some point, we need to draw a line from point A to point B gradually. I works great on every devices we own, except from the iPhone 5 (iOS 10.2.1) and the Ipad (1st gen, 9.3.5) (works on iPhone 6).

The problem is that on this devices, the line starts to "draw", but after the first "update", it stops, leaving the line incomplete (no error, and the game works well). At first, we used a DIY solution based on "while" and calculations, so we tried using Lerp, same issue.

That's really strange... As someone ever encounter this problem?

EDIT : added code for the drawing

 GameObject line_tmp = Instantiate(line_fig_prefab);
 line_tmp.GetComponent<LineRenderer> ().SetPosition (0, pos_line_end);
 line_tmp.GetComponent<LineRenderer> ().SetPosition (1, pos_line_end);
 float t = 0f;
 while (line_tmp.GetComponent<LineRenderer> ().GetPosition (1) != end_pos)
 {
     line_tmp.GetComponent<LineRenderer> ().SetPosition (1, Vector3.Lerp(pos_line_end, end_pos, t));
     t += 0.05f;
     yield return null;
 }

EDIT 2 : Finaly found why. On old Apple devices (iPhone 5, iPad 1, ...), the texture needs to be POT sized (16x16, 32x32, ...). Thanks Harinezumi for your help !

Comment
Add comment · Show 3
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 Harinezumi · Oct 18, 2017 at 10:08 AM 1
Share

Could you please provide more information about which version of Unity you are using and how do you draw the lines? (off the top of my head I can list 3 very different ways).

Either way, this will probably be a graphics capability issue.

avatar image SamuelRousseaux Harinezumi · Oct 18, 2017 at 11:56 AM 0
Share

Edited the post :)

avatar image Owen-Reynolds · Oct 18, 2017 at 04:05 PM 0
Share

This should be working, just at 1/2-speed. $$anonymous$$aybe try also placing a small ball at endPos? $$anonymous$$y guess is it's an issue with the lineRenderer not displaying correctly, and you will see the ball move.

Harenizumi suggests changing the curPos!=endPos to t<1. That's not a bad idea, but it's not the problem. Even if the loop runs forever, it should still move the line (also there's no float rounding problem with Lerps -- when t>=1 it gives the exact end as the result.)

Likewise H's suggestion of using deltaTime*3 ins$$anonymous$$d of 0.05 might be better (but still not the same as 60fps,) but your code should still be moving the line, just slower.

2 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Harinezumi · Oct 20, 2017 at 11:27 AM

Is your texture POT sized? I've found some answers that were solved by changing the texture to a power of two size, e.g. here. Another possible issue could be the limited precision of UVs on iOS - described here.

Comment
Add comment · Show 5 · 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
avatar image SamuelRousseaux · Oct 20, 2017 at 12:27 PM 0
Share

Exactly what I found when I wrote the last comment :) I'm trying it right now

avatar image SamuelRousseaux SamuelRousseaux · Oct 20, 2017 at 12:33 PM 1
Share

That was it ! Seems like old Apple devices need to have POT sized textures to tile it :)

avatar image Harinezumi SamuelRousseaux · Oct 20, 2017 at 02:29 PM 0
Share

Perfect, glad that it is now solved! :)

Show more comments
avatar image denizerturk · Dec 27, 2021 at 02:45 PM 0
Share

Thank you! this helped me a lot

avatar image
0

Answer by Harinezumi · Oct 18, 2017 at 12:50 PM

Thanks for providing code example.

I would make some changes to the code (see below). However, I'm not sure this will solve your issues with certain hardware. If not, just comment on it and I'll try to help figuring it out.

 public LineRenderer line_fig_prefab;
 
 private IEnumerator DrawLineCoroutine () {
 LineRenderer line_tmp = Instantiate(line_fig_prefab); // this way you immediately get the LineRenderer component
  line_tmp.SetPosition (0, pos_line_end);
  line_tmp.SetPosition (1, pos_line_end);
  float t = 0f;
  // while (line_tmp.GetPosition (1) != end_pos) due to floating point imprecision this will always be true; instead use
 while (t < 1) // or even better: t < lineDrawDuration
  {
      line_tmp.SetPosition (1, Vector3.Lerp(pos_line_end, end_pos, t)); // if using lineDrawDuration use here t / lineDrawDuration
      t += Time.deltaTime; // will draw using real update time
      yield return null;
  }
 line_tmp.SetPosition(1, end_pos); // making sure that the end point is set precisely, even if t overshoots
 }

Sorry for any syntax errors and missing formatting, I'm writing from my phone.

Comment
Add comment · Show 7 · 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
avatar image SamuelRousseaux · Oct 18, 2017 at 02:20 PM 0
Share

Can't try this right now, because the person who has the iPhone and iPad left an hour ago, but be sure I'll try this tomorrow !

avatar image SamuelRousseaux SamuelRousseaux · Oct 20, 2017 at 09:21 AM 0
Share

The problem is still here with this method :/

avatar image Harinezumi SamuelRousseaux · Oct 20, 2017 at 09:42 AM 0
Share

$$anonymous$$aybe it is the same issue as here?

Show more comments

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

109 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

Related Questions

iOS Resolutions iPhone and iPad 0 Answers

Crash on iPhone 6/iPad Air 2 in MemoryProfiler? 0 Answers

Unity Ipad aspect ratio issue 1 Answer

Game does not start up after I allready playtested it on iPad and iPhone 0 Answers

iOS Device Screen UI Resolution 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