Create Buffer


Description

This action can be used to allocate a portion of memory as a buffer in your game, with the function returning the unique buffer id value that should be stored in a variable and used for all further function calls to the buffer. You can supply a global variable, an instance variable or have the action create a temporary local variable for storing the buffer ID. Note that you can create additional buffers by clicking the plus icon beside the action, and selecting another variable to hold the buffer ID.

NOTE: It's important that you remove any dynamically created resources like this from memory when you no longer need them to prevent memory leaks, so when you are finished with the buffer that you have created you should free it up again using Delete Buffer action (in the Other - Clean Up event, for example). This is especially important to remember when using a temporary local variable, as if you do not remove the buffer again before the end of the event or action script then you will no longer be able access it and can have issues later.


Action Syntax:

Create Buffer Syntax


Arguments:

Argument Description
Buffer The buffer index (stored in a variable)
Value The value to add into the list


Example:

Create Buffer Example
The above action block code creates a global variable and then a buffer, assigning the unique buffer ID to the variable. This buffer than has two pieces of data written to it.