Skip to main content

Set Book Menu Data and Page Sections (Design Time and Run Time)

Set Book Menu Data at design time

The Book Menu Data normally should be set at design time. At least a possible default value.
It can be set either on the Book Menu Component or the Book Menu Actor directly

Book Menu Component

Option 1:

Set the Book Menu Data on the Class Default value inside any actor that instantiates the Book Menu Component

image.png

Option 2:

Another way is to set the Book Menu Data on an actor that instantiates the Book Menu Component inside the 3D Viewport.

image.png


Book Menu Actor

Option 1:

Set the Book Menu Data on the Class Default value inside the Book Menu Actor. 

This only works if the Book Menu Actor gets used directly e.g. by Placing it in the World.
If the Book Menu Actor gets instantiated via a Book Menu Component, always the Book Menu Component Value overwrites the default value of the Book Menu Actor

image.png

Option 2:

Another way is to set the Book Menu Data on an Book Menu Actor that was directly placed in the World inside the 3D Viewport.

image.png

Set Book Menu Data at run time

The Book Menu Data can also be set after Begin play at run time.
It can be set either on the Book Menu Component or the Book Menu Actor directly

Book Menu Component

Let's assume the Book Menu Component is instantiated on an Actor called PlayerPawn.
Inside the PlayerPawn Blueprint on the Begin Play function, we want to set the Book Menu Data at run time.

To do this we can simply call the function "SetBookMenuData" on the Book Menu Component.

image.png

At Begin Play this will set the Book Menu Data and initialize all necessary parts of the Book Menu Component. 

Book Menu Actor

the same function can also be called directly on the Book Menu Actor. Again, let's assume the Book Menu Component is instantiated on an Actor called PlayerPawn.
Inside the PlayerPawn Blueprint on the Begin Play function, we want to set the Book Menu Data at run time.

But this time we get the Book Menu Actor first from the Book Menu Component and call  the function "SetBookMenuData" on the Book Menu Acor directly instead.

The example might look a bit silly but actually this shows us that the functions can be called on the Book Menu Actor as stand alone. In case we don't have a Book Menu Component (e.g. because the Book Menu Actor was placed directly in the World)

image.png


Add Page Sections to the Book Menu Data at run time

Usually the Book Menu Data Assets get created at design time, which means inside the content browser before running the game.
Sometimes you may want to add some page sections dynamically at runtime.

Because the Book Menu Data Assets instances created in the Content Browser might be used by many different Book Menu Actors (or Book Menu Components), it might not be a good idea to manipulate the
Book Menu Data instances directly. Because this change would affect any Book Menu Actor that has a reference to the Book Menu Data Asset.

The Bok Menu Plugin cares about this problem by cloning the Book Menu Data Asset first before using it internally. Additionally the Plugin provides a function to create runtime instances of the Book Menu Data Assets to work with at runtme
without manipulating the default instances.

Let's assume the Book Menu Component is instantiated on an Actor called PlayerPawn.
Inside the PlayerPawn Blueprint on the Begin Play function, we want to

  • create a runtime instance of a Book Menu Data Asset
  • add a page section to it
  • set the new Book Menu Data on the Book Menu Component
  • open the book at the newly created section

Here you can see the Blueprint for this: