In-game book

I would like to implement a book in my game. This is quite a lot of plain text, which I’d prefer to store in text files. Maybe i could even add my own markup to this.

When it comes to rendering the text, what would be a performant way to do it? I was thinking about have a book mesh, and I’d like the text to appear on the page. I am ok with using a flat plane to start with. Should I create TextMeshPro texts from a script, and place them a tiny bit about the page surface, destroying and creating them as the player goes through the pages?
I could probably do something similar, but with a render texture, which would let me bend the page (not a high priority)…or even animate the page turn.

I’m sure there are other ways to do this…suggestions please :slight_smile:

It depends a lot on how you want to actually display the book in-game. If you’re looking to create some sort of VR Book Reading Simulator, that would be completely different from a Skyrim style book.

I don’t really remember how the skyrim books worked, and I haven’t played it in vr. Basically I want a reference manual in my VR game, exactly how it looks isn’t too important and I’m open to ideas. It does need to be in-world though, and not a screenspace thing. The closer it looks to a paper based reading experience the better. I will not support third-party texts. Oh and that it is performant for VR is the most important thing. I’d like to display checklists and paragraphs of text, which the player can flip through. These are likely to require a lot of revision and changes as I develop the game, which is why I prefer having the source as text files and not textures. I can probably manage some markup tags in the source files, but not having used textmeshpro before, I’m unsure if this is a suitable application for it, or if its the ideal thing.

The million dollar question here is basically what kind of markup you need to support. More specifically, is all the markup you need to support covered by TMP? If so, then yeah you can just have a bunch of text files (as TextAssets, or as text files in StreamingAssets) and just set the text value of each page as desired. You could have each “book” as a text file, and separate each page by some delimiter you’ve chosen, using string.split to divide it up as your player reads the book.

You can render the TextMeshPro to a render texture and assign that render texture to the in-game book’s pages. Performance would be great (as efficient to render as any other texture) and it’d be fairly straightforward to set up.

If you need more markup support than that, then things will get complicated fast.

Aside from the the internal page setup (which I would probably do with render textures as @StarManta suggests) you could use the Mega Fiers plugin for rendering the book itself. It’s an expensive plugin but I’ve used it in the past and it works well. Here’s a video of it in action:

Thanks guys. Sounds like I’m on the right track. I haven’t looked much at TMP capabilities but for my markup I can’t imagine I need more than a size change, centered text, and underlines, and I assume TMP has no trouble with these.

That book video above looks sweet, but I’ll probably just do a blender animation and use 2 or 4 render textures.