Let's talk

RSExamplePlayerState.h

Examples/RSExamplePlayerState.h Raw Download ZIP

Click a line number to link it. Shift-click to select a range.

1// Copyright (c) 2026 Reignance Studios. MIT License, see LICENSE.
2// Example only: copy into your game module and rename the RSExample prefix.
3// Tutorial: https://reignancestudios.com/tutorial-gas-asc-on-playerstate
4
5#pragma once
6
7#include "CoreMinimal.h"
8#include "AbilitySystemInterface.h"
9#include "GameFramework/PlayerState.h"
10#include "RSExamplePlayerState.generated.h"
11
12class UAbilitySystemComponent;
13class URSExampleAttributeSet;
14
15UCLASS()
16class ARSExamplePlayerState : public APlayerState, public IAbilitySystemInterface
17{
18 GENERATED_BODY()
19
20public:
21 ARSExamplePlayerState();
22
23 virtual UAbilitySystemComponent* GetAbilitySystemComponent() const override { return AbilitySystem; }
24
25protected:
26 // The ASC lives here so abilities, effects and attributes survive pawn death and respawn.
27 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Abilities")
28 TObjectPtr<UAbilitySystemComponent> AbilitySystem;
29
30 UPROPERTY()
31 TObjectPtr<URSExampleAttributeSet> Attributes;
32};

Still desyncing in packaged builds?

Free code fixes one symptom. A Diagnostic finds the cause across your project in two days.