Skip to main content

Creating New Permissions

This guide explains how to create and configure access permissions for containers in the Gameplay Containers plugin. These permissions define what actions users can perform when interacting with a container they do not own.


Step-by-Step Instructions

1. Create a Permission Data Asset

  • Navigate to Miscellaneous > Data Asset in the Content Browser.
  • Select GameplayContainerPermission as the parent class.
  • Name the asset appropriately (e.g., MyPermission).

GameplayItemDefinition Properties


2. Configure the Permission Data Asset

  • Open the newly created data asset.
  • Define what operations users can perform on containers by adding them to the Operations Array:
    • If an operation is included, the user can perform it based on the selected Policy.
    • If an operation is excluded, the user cannot perform it.

Policies Explanation

PolicyDescription
NoRestrictionsThe operation can be performed without any limitation.
RestrictWithinSelfThe operation can only be performed inside the container itself.
RestrictIncomingThe operation is rejected if it originates from another container but is allowed if directed to/from the current container.
RestrictOutgoingThe operation is rejected if directed to another container but is allowed if coming from another container or the current one.
CustomCustom logic can be defined by creating a blueprint inheriting from GameplayContainerCustomOperationPolicy.

Note:
For the Custom policy:

  • Override the function CanPerformOperation in your custom policy blueprint.
  • Implement your logic to determine if the operation is allowed and return the appropriate result.

GameplayItemDefinition Properties


3. Assign the Permission to a Container

  • Open the container’s Definition Data Asset.
  • Add a Permission Fragment to the container.
  • Assign the permission data asset you created earlier as the active permission set for users.

GameplayItemDefinition Properties

Additional Note:

  • You can modify permissions dynamically at runtime by calling the ModifyUserPermissions function on the container component.
  • This function will replace the existing permission set with the new one, but only if AllowUserPermissionModification is enabled in the container’s Definition Permissions Fragment.

4. Save and Test

  • Save all changes to your assets and configurations.
  • Test the permissions by interacting with the container and ensuring users can only perform the allowed operations.
info

In this case the container user can only move items within the same container or to different containers, all other operations are rejected.

GameplayItemDefinition Properties


Important Notes

  1. These permissions apply only to users of the container, i.e., players who do not own the container.
  2. The actor owning the container component has full access to all operations by default.
  3. Permissions apply only to user actions. Operations like adding items, handling overflow, etc., are explicitly reserved for the container owner or the server authority.