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 /
avatar image
0
Question by dany_leon · Aug 21, 2016 at 01:30 AM · androidandroid buildtexture2d

Changing texture at runtime not working on android build

Hello, I'm working on a digital book for an Android tablet. I'm using this Page Curler plugin from the Asset Store.

I have 3 main planes: LeftPage, RightPage and TurningPage, and I keep an index (for each page) of which page I'm looking so I can manage the corresponding textures. When I click on one of the Left or Right pages, the turning page animation starts playing and when it ends, I update the index values and the corresponding textures.

 void Update()
 {
      ...
 
      // If click is in one of four defined areas.
      if (mouseX > 970 && mouseX < 1024 && canFlipFwd)
      {
           if (mouseY > 250 && mouseY < 710)
           {
                clickCase = 1; // Play animation 1. 
                changePageFwd();
           }
           else if (mouseY > 50 && mouseY <= 250)
           {
                clickCase = 2; // Play animation 2.
                changePageFwd();
           }
      }
      else
      {
           ...
      }
 }
 
 void PageFlipOver(bool pageTurned)
 {
      if (pageTurned)
      {
           // Update page index.
           indRight += 2;
           indPage += 2;
 
           if (indLeft + 2 < pages.Length)
           {
                indLeft += 2;
                leftBackground.mainTexture = pages[indLeft];
 
                if (indLeft + 2 < pages.Length)
                     pageBack.mainTexture = pages[indLeft + 2];
                else
                     pageBack.mainTexture = pages[indLeft];
           }
 
           if (!canFlipBkw)
                 canFlipBkw = true;
      }
 
      canFlip = true;
 }
 
 void changePageFwd()
 {
      if (indRight < pages.Length)
      {
           rightBackground.mainTexture = pages[indRight];
      }
      else
      {
           rightBackground.mainTexture = alpha;
           canFlipFwd = false;
      }
 
      if (indPage < pages.Length)
           pageFront.mainTexture = pages[indPage];
 }

It works perfect in Unity Editor and perfect with Unity Remote in the tablet, but when I run the installed apk, the turning page is always showing the textures assigned at the begining (Akawe( )). The Left and Right pages work fine.

Printing the assigned texture name (pageFront.mainTexture.name) I get the correct texture which is equivalent to the page index value, but the turningPage keeps showing the initial texture (indPage = 0).

All the textures are asigned on the editor on a Texture2D array.

Any help is welcome, I've been stuck with this for two weeks and I can't find what's wrong.

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 IsaiahKelly · Aug 21, 2016 at 02:59 AM

Have you tried contacting the developer of the asset for help? I'm afraid your issue might be a bit too specific for most people here to help. Since this seems to require some knowledge of the asset package and how it functions.

All I can tell by looking at the asset page is that it's using a custom shader for the page curling effect. So maybe that's causing problems on android?

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

Android build - Black screen 0 Answers

Could not find Multidex Version - Gradle Build Failed 0 Answers

Android Emulator fails to install Unity .apk 0 Answers

Error when trying to export to android (Linux) 0 Answers

SQLite problem after updating to 2018.2.17f1 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