Help us understand the problem. What is going on with this article?

UE4 よく使うUPROPERTYメモ

More than 3 years have passed since last update.

詳細ウインドウ周り

アクセス権系の属性

  • 属性毎のアクセス出来る範囲
レベルエディター:閲覧 レベルエディター:編集 ブループリントエディター等:閲覧 ブループリントエディター等:編集
EditAnywhere
EditDefaultsOnly × ×
EditInstanceOnly × ×
VisibleAnywhere × ×
VisibleDefaultsOnly × × ×
VisibleInstanceOnly × × ×
  • 実行結果
PropertyActor.h
// 見づらいので他のカテゴリは非表示
UCLASS(HideCategories = (Actor, Input, Rendering, Replication, ActorTick, Transform))
class TESTCPP_API APropertyActor : public AActor
{
    GENERATED_BODY()
public: // Edit系
    UPROPERTY(EditAnywhere, Category = "Edit")
    int32 EditAnywhere;
    UPROPERTY(EditDefaultsOnly, Category = "Edit")
    int32 EditDefaultsOnly;
    UPROPERTY(EditInstanceOnly, Category = "Edit")
    int32 EditInstanceOnly;

public: // Visible系
    UPROPERTY(VisibleAnywhere, Category = "Visible")
    int32 VisibleAnywhere;
    UPROPERTY(VisibleDefaultsOnly, Category = "Visible")
    int32 VisibleDefaultsOnly;
    UPROPERTY(VisibleInstanceOnly, Category = "Visible")
    int32 VisibleInstanceOnly;

    // (以下省略

レベルエディターの詳細パネル/ブループリントの詳細パネル
imageimage

その他

AdvancedDisplay

カテゴリの下に詳細設定として隠す事が出来ます

UPROPERTY(EditAnywhere, AdvancedDisplay, Category = "AdvancedDisplay")
int32 AdvancedDisplay;

image

EditFixedSize

配列の要素数を変更を禁止します。

UPROPERTY(EditAnywhere, EditFixedSize, Category = "EditFixedSize")
TArray<FName> EditFixedSize;
UPROPERTY(EditAnywhere, Category = "EditFixedSize")
TArray<FName> NoEditFixedSize;

image

Instanced(EditInlineは非推奨です)

インスタンス+変数値を入れる事が出来ます。
対象のクラスにはUCLASS(EditInlineNew)をつけるようにしてください。

SampleObject.h
UCLASS(EditInlineNew)
class モジュール名_API USampleObject : public UObject
{
    GENERATED_BODY()
public:
    UPROPERTY(EditAnywhere, Category="Variable")
    int32 Variable; 
};
UPROPERTY(EditAnywhere, Instanced, Category = "Instanced")
USampleObject* Instanced;

image

条件付

「meta = (EditCondition = 変数名)」で条件付きの変数を作る事が出来ます

UPROPERTY(EditAnywhere, Category = "Condition", meta = (EditCondition = bEditCondition))
int32 EditConditionVariable;
UPROPERTY()
bool bEditCondition;

image

ブループリント関連

ブループリントアクセス権限

UPROPERTY(BlueprintReadOnly, Category = "Variable|Blueprint")
int32 BlueprintReadOnly; // Getのみ公開
UPROPERTY(BlueprintReadWrite, Category = "Variable|Blueprint")
int32 BlueprintReadWrite; // Get・Set両方公開

image

スポーン時に公開

UPROPERTY(BlueprintReadWrite, Category = "Variable", Meta = (ExposeOnSpawn = true))
FVector Location;

image

その他

Show 3D Widget

Meta = (MakeEditWidget = true)を有効にすることで「3Dウィジェットを表示する」が有効になります

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Variable", Meta = (MakeEditWidget = true))
FVector Location;

image

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away