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.