-
Notifications
You must be signed in to change notification settings - Fork 1
Gameplay Interaction Setup Guide
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
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
Pluginsfolder if it does not exist already, and paste theGameplayInteractionfolder in there.
See the image below for reference:
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:
Step 5: Right click Unify.uproject file and click on Genereate Visual Studio project files
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.hheader file in your IDE solution files
- Now, you will need to enable Compile Gameplay Interaction plugin code by changing
COMPILE_GAMEPLAY_INTERACTIONvalue from 0 to 1
- Next, you will need to navigate to
UnifyPlayerController.hand edit the code shown in the image below, by uncommenting the UFUNCTION & UPROPERTY and then commenting the macro.
The code in UnifyPlayerController.h should look like this after editing
- Next, in your IDE navigate to
Plugins/GameplayInteraction/GameplayInteraction.Build.csand addUnifyto thePublicDependencyModuleNames
- Next, in your IDE navigate to
Plugins/GameplayInteraction/Public/Core/Abilities/GameplayAbility_Interact.hand change the parent class to useUnifyGameplayAbility.hand same forPlugins/GameplayInteraction/Public/Core/Abilities/GameplayAbility_Interaction.hchange it to useUnifyGameplayAbility.halso the same case forPlugins/GameplayInteraction/Public/Core/Abilities/GameplayAbility_Interaction_ShowOptions.hlike in the picture below
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 > Collisionand make sure you add the collision presets in the pictures below.
- Next, navigate to
Plugins/GameplayInteraction/Content
- Few things to setup here, if you navigate to
Input/Configsyou 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
- Then, search for
UnifyorInputand chooseUnifyInputConfigthen pressSelect
- You may rename it however you like, I renamed it to
UIC_GameplayInteractionin this case, UIC short for UnifyInputConfig
- Next, open that data asset
UIC_GameplayInteractionand add 2 entries toAbility Input Actionsand add the gameplay interaction input actions like mentioned in the picture below, make sure they also have the same input pressed/released triggers
- 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 Assetthen searching forUnifyand selectingUnifyAbilitySetand pressSelect
- Now rename the newly created data asset however you like, I renamed it to
UAS_GameplayInteractionwith UAS short for UnifyAbilitySet
- Next, open the
UAS_GameplayInteractionand add 2 entries toGranted Abilitieslike the picture below
- Next, go to
Unify/Content/Charactersand openBP_Unify_Characterblueprint underVariablesUnify > InputCategory click onInput ConfigsAnd on the left side panel add a new input config and select the one we recently createdUIC_GameplayInteraction
- Next, under the same category
Unify > AbilitiesselectAbility Setsand on the left side panel add a new ability set and select the one we recently createdUAS_GameplayInteraction
- Next, go to plugin content folder and navigate to
Content/Core/Abilitiesand openGA_Interactability blueprint and make sure theActivation Policyis set toOn Spawn
- Also make sure the
GA_Interactability blueprint tasks are using the collision profiles that we added earlier to the project settings like in the picture below.
- 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
- Next, lets setup the UI elements. First navigate to Unify Content folder
Content/UI/Menusand create an activatable widget inheriting fromUnifyActivatableWidgetand call itW_InteractionMenuthen 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.
- Now, close this widget blueprint and go to
GA_Interact_ShowOptionsability blueprint, which can be found in plugin content folderContent/Core/Abilitiesand open it and inPush Content to Layer for Playernode select the widget we just created then save and close the ability.
- Next, go to Unify content folder and navigate to
Content/UI/HUDand openW_HUDwidget and under the Overlay element add the following elementsWBP_Interaction_Indicatorlike in the picture below.
- Next, add another element under the same overlay, which is
WBP_Interaction_Timed_Indicatorlike the picture below.
- NOTE: Make sure to change the visibility of these 2 added elements to
Collpasedinitially.
- 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
- Next, add the outline material to be used by the post process volume, and select
MI_Outlinewhich is provided by the gameplay interaction plugin.
- Next, drag an interactive entity from the plugin Content folder in
Content/Entitiesand place it in your level.
- Now press play to test it and walk to the placed entity and try to interact with it.