[Unreal 5] SaveGame 으로 stuct를 저장할때 값이 변경되는 문제.

2025. 1. 6. 21:10·Unreal 5/Troubleshooting
USTRUCT()
struct FWeaponSaveData
{
	GENERATED_BODY()
public:
	FWeaponSaveData(): WeaponType(EWeaponType::None), WeaponTier(EWeaponTier::None) {}
	FWeaponSaveData(EWeaponType Type, EWeaponTier Tier): WeaponType(Type), WeaponTier(Tier) {}
	EWeaponType WeaponType;
	EWeaponTier WeaponTier;
};

UCLASS()
class PROJECT_4_API UPlayerData : public USaveGame
{
	GENERATED_BODY()
	
public:
	UPROPERTY()
	TArray<FWeaponSaveData> WeaponSaveData;
};

 

데이터를 저장할때 이런식으로 struct를 저장하고 싶을 때가 있다.

분명 데이터를 정확하게 넣었는데 저장된 세이브를 불러서 값을 확인해보면 이상하게 나온다.

 

이에 언리얼 포럼에서는 이렇게 말한다.

 

 

자 변역을 해보자면 struct의 변수들을 UPROPERTY로 플래그를 지정해줘야 구조체가 SaveGame에서 직렬화 된다고 한다... 냉큼 바꿔보자

USTRUCT()
struct FWeaponSaveData
{
	GENERATED_BODY()
public:
	FWeaponSaveData(): WeaponType(EWeaponType::None), WeaponTier(EWeaponTier::None) {}
	FWeaponSaveData(EWeaponType Type, EWeaponTier Tier): WeaponType(Type), WeaponTier(Tier) {}
	UPROPERTY()
	EWeaponType WeaponType;
	UPROPERTY()
	EWeaponTier WeaponTier;
};

 

 

 

GOOD!

'Unreal 5 > Troubleshooting' 카테고리의 다른 글

[Unreal 5 / C++] BlueprintNativeEvent 사용 시 주의 점  (0) 2025.02.28
[Unreal 5] C++ 클래스가 언리얼 에디터에서 보이지 않거나 삭제하고 싶을 때  (0) 2024.12.27
[Unreal 5] C++ 클래스 빨간줄이 발생할 때  (0) 2024.12.27
'Unreal 5/Troubleshooting' 카테고리의 다른 글
  • [Unreal 5 / C++] BlueprintNativeEvent 사용 시 주의 점
  • [Unreal 5] C++ 클래스가 언리얼 에디터에서 보이지 않거나 삭제하고 싶을 때
  • [Unreal 5] C++ 클래스 빨간줄이 발생할 때
돼지표
돼지표
https://github.com/wkdgns135
  • 돼지표
    돼지표 개발 스토리
    돼지표
  • 전체
    오늘
    어제
    • 분류 전체보기 (99)
      • C++ (58)
        • Algorithm (52)
      • Python (1)
      • Machine Learning (2)
      • Computer Graphics (4)
        • Curly Hair Simulation (2)
      • GPU Programming (11)
        • CUDA basic (7)
        • CUDA fluidsGL (4)
      • Unreal 5 (20)
        • Troubleshooting (4)
        • FPS Shooting (5)
        • Study (9)
        • EOS (1)
      • Computer Science (3)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

    • Github
  • 공지사항

  • 인기 글

  • 태그

    dp
    unreal 5
    아이작 맵 생성
    GPU Programming
    위상 정렬
    구현
    OpenGL
    수학
    자료 구조
    그리디 알고리즘
    Fluid Simulation
    Rendering Pipeline
    FPS
    CUDA
    그래프 탐색
    BFS
    CS
    UE5
    Algorithm
    C++
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
돼지표
[Unreal 5] SaveGame 으로 stuct를 저장할때 값이 변경되는 문제.
상단으로

티스토리툴바