Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- Unreal Engine Error
- deltaTime
- staticmesh mobility
- ai jitter
- redirection crash
- Random Map Generator
- 랜덤 맵 생성
- ai 주춤거림
- ai 뚝뚝 끊김
- UnrealEngine
- unreal engine
- 언리얼
- 리디렉션 크래쉬
- ue4 Crash
- unreal engine redirection crash
- 리디렉터 크래쉬
- Unreal Engine 4
- register component
- unity
- splinemeshcomponent scale
- Ai
- UE
- 13iew
- unreal ai lag
- ue4 error
- LittleNightMare
- Unreal Engine 5
- UE5
- UE4
- redirector crash
Archives
- Today
- Total
Class GameDev* SheepAdult
[Unreal Engine 4.27] Able / Disable Detail Property - EditCondition 본문
Unreal Engine
[Unreal Engine 4.27] Able / Disable Detail Property - EditCondition
SheepAdult 2022. 9. 25. 21:23우리가 만약 UPROPERTY()로 선언한 변수 값이 늘어나 디테일 창에서 정리를 하고 싶거나 특정 값을 기준으로 해당 값을 Disable(Deactivated) 혹은 Able(Activate) 시키고 싶을 때가 있을 것이다. 이럴 경우 언리얼 UPROPERTY()의 EditCondition을 사용하면 된다.
사용법은 아래와 같다.
UPROPERTY(Specifier, meta=(EditCondition="BooleanPropertyName"))
자료형 변수명;
EditCondition은 Boolean 자료형을 받으며 true 조건이 되면 활성화가 되고 false 조건이면 비활성화가 된다.
테스트로 아래와 같이 코드를 작성해 보았다.
UPROPERTY(EditAnywhere)
bool bIsTesting = false;
UPROPERTY(EditAnywhere, meta = (EditCondition = "bIsTesting"))
int Num;
UPROPERTY(EditAnywhere, meta = (EditCondition = "!bIsTesting"))
float Float;
위의 코드는 bIsTesing에 따라서 EditCondition의 값도 달라지므로 Num과 Float의 활성화 여부를 결정할 수 있다. 결과는 아래와 같다.
만약 비활성화일 때 아예 숨기고 싶을 경우에는 어떻게 할까?
meta의 인자로 EditConditionHides를 넣어 아래와 같이 작성하면 된다.
UPROPERTY(EditAnywhere)
bool bIsTesting = false;
UPROPERTY(EditAnywhere, meta = (EditCondition = "bIsTesting", EditConditionHides))
int Num;
UPROPERTY(EditAnywhere, meta = (EditCondition = "!bIsTesting", EditConditionHides))
float Float;
결과는 아래와 같다.
EditCondition이 boolean 값을 받는다는 점에서 다양하게 사용이 가능하다. &&나 || 로도 좀 더 복잡한 조건을 받을 수 있으며 아래와 같이 수의 범위로도 정할 수 있다.
UPROPERTY(EditAnywhere)
int bIsTesting;
UPROPERTY(EditAnywhere, meta = (EditCondition = "bIsTesting > 10"))
int Num;
UPROPERTY(EditAnywhere, meta = (EditCondition = "bIsTesting < 8"))
float Float;
추가로 Enum 값으로도 받을 수 있다.
아래는 내가 실제 프로젝트에서 사용한 코드이다.
// MyEnums.h
UENUM(BlueprintType)
enum class ECheckPointType : uint8
{
CheckPoint UMETA(DisplayName = "CheckPoint"),
ToNextLevel UMETA(DisplayName = "ToNextLevel")
};
// CheckPoint.h
#include <MyEnums.h>
...
UPROPERTY(EditAnywhere)
TEnumAsByte <ECheckPointType> CheckPointType = ECheckPointType::CheckPoint;
UPROPERTY(EditAnywhere, meta = (EditCondition = "CheckPointType == ECheckPointType::CheckPoint"))
FString SavePointName;
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (EditCondition = "CheckPointType == ECheckPointType::CheckPoint"))
TEnumAsByte<ECheckPointRespawnType> CheckPointRespawnType = ECheckPointRespawnType::Getup;
UPROPERTY(EditAnywhere, meta = (EditCondition = "CheckPointType == ECheckPointType::ToNextLevel"))
FString NextLevelName;
...
결과는 예상되겠지만 아래와 같다.
끄읕.
'Unreal Engine' 카테고리의 다른 글
[Unreal Engine] Error 모음 (계속 추가하며) (0) | 2022.11.10 |
---|---|
[Unreal Engine 4] Error - 'void ConstructorHelpers::ValidateObject(...) :인수 1을(를) 'T *'에서 'UObject *'(으)로 변환할 수 없습니다.' (0) | 2022.11.06 |
[Unreal Engine 4.27 C++] PURE_VIRTUAL Macro는 순수 가상 함수인가? (0) | 2022.08.21 |
[Unreal Engine] Game Pause 시 특정 키 입력 가능하게 하기 (0) | 2022.07.12 |
[Unreal Engine] Level Sequence Keep State 레벨 시퀀스 상태 유지 (0) | 2022.07.12 |