Skip to content

Gameplay Interaction Setup Guide ‐ Unify Demo Project

Nazake edited this page Aug 10, 2024 · 3 revisions

Downloading and Locating the Gameplay Interaction Plugin

NOTE: If an image is not clear, right click it and choose Open Image In New Tab

Step 1: Download the Gameplay Interaction plugin from the Epic Games Launcher for whatever engine version you wish to use from 5.2 and above.

Step 2: After downloading, you can find the plugin in the following directory:

{EngineDirectory}/Plugins/Marketplace/GameplayInteraction

Capturewwww

Step 3: Make sure your project is closed (the editor is not running), then copy the GameplayInteraction plugin folder to your project and paste it inside the Plugins folder.

  • Note: Create the Plugins folder if it does not exist already, and paste the GameplayInteraction folder in there.

See the image below for reference:

dwdw qqqq

Step 4: Open your project in Unreal Editor, and go to Edit > Plugins > Gameplay category. Ensure that the plugin "Gameplay Interaction" is enabled. If it's not, click on the enable checkbox to the left, and you might be prompted to restart the editor.

See the image below for reference:

www

Step 5: Right click Unify.uproject file and click on Genereate Visual Studio project files

wewewe

Step 6: Open the project solution in your favorite IDE, I use JetBrains Rider IDE for UnrealEngine.

Step 7: Implementation, we will need to change few things to implement the plugin.

  • Navigate to Unify.h header file in your IDE solution files

wdwd

  • Now, you will need to enable Compile Gameplay Interaction plugin code by changing COMPILE_GAMEPLAY_INTERACTION value from 0 to 1

wwww

  • Next, you will need to navigate to UnifyPlayerController.h and edit the code shown in the image below, by uncommenting the UFUNCTION & UPROPERTY and then commenting the macro.

wewew

The code in UnifyPlayerController.h should look like this after editing

0000

  • Next, in your IDE navigate to Plugins/GameplayInteraction/GameplayInteraction.Build.cs and add Unify to the PublicDependencyModuleNames

ewewew

  • Next, in your IDE navigate to Plugins/GameplayInteraction/Public/Core/Abilities/GameplayAbility_Interact.h and change the parent class to use UnifyGameplayAbility.h and same for Plugins/GameplayInteraction/Public/Core/Abilities/GameplayAbility_Interaction.h change it to use UnifyGameplayAbility.h also the same case for Plugins/GameplayInteraction/Public/Core/Abilities/GameplayAbility_Interaction_ShowOptions.h like in the picture below

qqqqq1 qqqq2 qweqweqwe

We're pretty much done here, now just compile the project and launch the unreal editor from IDE or manually.

  • When you open the unreal engine editor, go to Project Settings > Collision and make sure you add the collision presets in the pictures below.

0111 0222

  • Next, navigate to Plugins/GameplayInteraction/Content

Capturewewe

  • Few things to setup here, if you navigate to Input/Configs you will most likely find an invalid input config asset. you can select it and press delete button to remove it, if it does not exist no worries, we will create a new one anyway.
  • Right click and choose Miscellaneous > Data Asset

wwewewe

  • Then, search for Unify or Input and choose UnifyInputConfig then press Select

wewewqqqqq

  • You may rename it however you like, I renamed it to UIC_GameplayInteraction in this case, UIC short for UnifyInputConfig

qweqwe

  • Next, open that data asset UIC_GameplayInteraction and add 2 entries to Ability Input Actions and add the gameplay interaction input actions like mentioned in the picture below, make sure they also have the same input pressed/released triggers

wwwqq

  • Next, Navigate to Plugins/GameplayInteraction/Content/Core/AbilitySets, you will most likely find an invalid data asset class, simply just select it and press delete button, if it does not exist no worries we will create a new one anyway.
  • Create a new data asset by right clicking and choosing Miscellaneous > Data Asset then searching for Unify and selecting UnifyAbilitySet and press Select

qweqwessss

  • Now rename the newly created data asset however you like, I renamed it to UAS_GameplayInteraction with UAS short for UnifyAbilitySet
  • Next, open the UAS_GameplayInteraction and add 2 entries to Granted Abilities like the picture below

weqwqqq

  • Next, go to Unify/Content/Characters and open BP_Unify_Character blueprint under Variables Unify > Input Category click on Input Configs And on the left side panel add a new input config and select the one we recently created UIC_GameplayInteraction

qewqeqwe

  • Next, under the same category Unify > Abilities select Ability Sets and on the left side panel add a new ability set and select the one we recently created UAS_GameplayInteraction

wewewewew

  • Next, go to plugin content folder and navigate to Content/Core/Abilities and open GA_Interact ability blueprint and make sure the Activation Policy is set to On Spawn

qweqweqwe

  • Also make sure the GA_Interact ability blueprint tasks are using the collision profiles that we added earlier to the project settings like in the picture below.

Captureqwqeqweqwe

- NOTE: If you encounter errors with abilities like OpenDoor, CloseDoor, Open GarageDoor, Close GarageDoor etc... Its because of an invalid cast the player controller, you can replace it like shown in the picture below to fix that error for all these abilities blueprint in CanActivateAbility function

qwdqwdwwww

  • Next, lets setup the UI elements. First navigate to Unify Content folder Content/UI/Menus and create an activatable widget inheriting from UnifyActivatableWidget and call it W_InteractionMenu then open it and add the interaction menu options to it like in the picture below.
  • I added a border with black brush color and made the background transparent.

Captureqweweqwe

  • Now, close this widget blueprint and go to GA_Interact_ShowOptions ability blueprint, which can be found in plugin content folder Content/Core/Abilities and open it and in Push Content to Layer for Player node select the widget we just created then save and close the ability.

qweqweqwe

  • Next, go to Unify content folder and navigate to Content/UI/HUD and open W_HUD widget and under the Overlay element add the following elements WBP_Interaction_Indicator like in the picture below.

qweqwe

  • Next, add another element under the same overlay, which is WBP_Interaction_Timed_Indicator like the picture below.

wqeqweqwaaaa

  • NOTE: Make sure to change the visibility of these 2 added elements to Collpased initially.
  • Next, to setup the outline material, you will need to add a post process volume to your Level and set Infinite Extent (Unbound) to true

qweqwesss

  • Next, add the outline material to be used by the post process volume, and select MI_Outline which is provided by the gameplay interaction plugin.

qqqqq

  • Next, drag an interactive entity from the plugin Content folder in Content/Entities and place it in your level.

qweqwe qweqweaaa

  • Now press play to test it and walk to the placed entity and try to interact with it.

Demo Project

Test the plugins in my demo project.

Documentation

Change Logs

Support

Join us on Discord.

Clone this wiki locally