Book Builder

There is a helper script included in the system to help make animating books using the Page mesh objects and the Page Flip modifiers. The video guide is at the bottom of the page so press play and follow along in Unity. It will first show you how to make a turning page then move on to building a book. This will involve you making 5 page meshes, 3 for the turning pages of the book and 2 for the covers. It will show how to group the objects under a main parent with helper objects for pivot points. Then by attaching the Mega Book component and filling in the params you will be left with a book that simply by changing one value will open the book turn all the pages, automatically update the page textures and then finally close the book. You have control over various params such as the number of pages, the texture for each page and vertical spacing.

The way the script works is by figuring out from the Book Alpha value the state of the book ie which page should be visible and how far turned it should be, it will then apply the correct page textures to the 3 pages to make it seem like the book is open at the correct point and apply the right turn value to the page flip modifiers. If the book is near the start of end it will rotate the front or back covers as needed. This is a basic system and it would be easy enough for someone with scripting knowledge to expand and improve it.


The Book builder is provided as an example of how the modifier system can be extended and used, it is meant to be used by the user as a learning tool and to be extended and customized. So have a go at improving the example code.

Book Params


The object that will be used as the front cover.


The object that will be used as the back cover.

Page 1

The object that will be used as the first visible page of the book, this object and the other page objects should have a working Page Flip effect applied already.

Page 2

The object that will be used as the second visible page.

Page 3

The object that be used as the third visible page of the book.


This is a list of the textures that make up the book, they should be in order and should be at least 6 and be an even number. Each pair make up a front and back of a page.

Book Alpha

Value from 0 to 1 for how far through the book to show, 0 is an unopened book, 0.5 is a book open half way through and 1 is a fully read book showing the back.

Cover Gap

Gap between the front and back covers.

Page Space

Gap between the pages.

MegaBook Classs

public class MegaBook : MonoBehaviour
    public GameObject       front;
    public GameObject       back;
    public GameObject       page1;
    public GameObject       page2;
    public GameObject       page3;
    public List<Texture>    pages;
    public float            bookalpha;
    public float            covergap;
    public float            pagespace;

Interacting with Book

If you want to add some form of interaction to your books you can use some simple code like the snippet below to link some form of input to the book alpha value in the script to control the page turn, so this could be mouse movement, key presses or a GUI element etc.

public float    dragsensi = 1.0f;
public float    keysensi = 1.0f;

// Call this from Update()
void Interactive()
    // Mouse version
    bookalpha += Input.GetAxis("Mouse X") * dragsensi;
    bookalpha = Mathf.Clamp(bookalpha, 0.0f, 100.0f);

    // Keyboard version
    bookalpha += Input.GetKey(KeyCode.A) * keysensi;
    bookalpha += Input.GetKey(KeyCode.D) * keysensi;
    bookalpha = Mathf.Clamp(bookalpha, 0.0f, 100.0f);

If you are using Unity 3.5 and notice a slight glitch in the texture swaps on turning pages then you should turn on ‘Late Update’ on the Modify Object component.

Video Guide


  • Greg


    Hi, I was wondering if your flip book does work with touch gestures? Not just pushing on buttons, but turn pages with fingers and zoom in to pages to read content. Also can a book be loaded from XML? Thanks Greg

    • spookycat


      Hi Greg The Book script is provided as an example of scripting the MegaFier system to do something more advanced than the basic modifier effects so it is not totally feature rich, I do plan on extending the system to a vastly improved one when I get MegaShapes and MegaMesh out, but until then all you need to do is link a gesture input to the bookalpha value in the script, so for example I have added a snippet of code above that shows how the mouse or keys can be linked to the book alpha value to interact with the book. So that could be extended easily to take a left or right gesture and add an appropriate amount to book alpha. Chris

      • Greg


        Hi Chris, Great info, thanks a lot for your prompt response! Looking forward to see how it will turn out! Greg

  • techdesignmate


    can you share your project Chris?

    • spookycat


      There really isn't anything to share the project was created as a tutorial for users to recreate so it was deleted after the video was made. The video shows all the steps needed to recreate the scene. If I can find a few minutes then I will see about making a scene in the package with a book in it.

You must be logged in to post a comment.