Hi.
I’ve made a class for storing data in my project derived from UDataAsset but I have some problems with it. Firstly, I can’t edit some of the properties in the editor, when the variable type is uint16, int8 etc.
This works, and allow me to change property inside the editor:
UPROPERTY(EditAnywhere, Category = "Main", meta = (ToolTip = "Part point value"))
int32 PointValue;
But this is not working (Edit box is greyed and disabled):
UPROPERTY(EditAnywhere, Category = "Main", meta = (ToolTip = "Part point value"))
uint16 PointValue;
Should it work that way?
Also, I’m not able to compile the code when my variable names starts with lowercase letters.
This compiles:
int32 PointValue;
And this does not:
int32 pointValue;
Is it a bug or it just has to begin with uppercase letters?
Thanks in advance.
My whole code:
Header
/******************************************************************************/
#pragma once
/******************************************************************************/
#include "TowerPart.generated.h"
/******************************************************************************/
UCLASS()
class UTowerPart : public UDataAsset
{
GENERATED_UCLASS_BODY()
public:
UPROPERTY(EditAnywhere, Category = "Main", meta = (ToolTip = "Part ID"))
int32 Id;
UPROPERTY(EditAnywhere, Category = "Main", meta = (ToolTip = "Part Name"))
FString Name;
UPROPERTY(EditAnywhere, Category = "Main", meta = (ToolTip = "Part Description"))
FString Description;
UPROPERTY(EditAnywhere, Category = "Main", meta = (ToolTip = "Should the IDs be disallowed or allowed"))
bool LimitationDisallow;
UPROPERTY(EditAnywhere, Category = "Main", meta = (ToolTip = "IDs to be allowed/disallowed"))
TArray<int32> Limitations;
UPROPERTY(EditAnywhere, Category = "Main", meta = (ToolTip = "Part cost"))
int32 Cost;
UPROPERTY(EditAnywhere, Category = "Main", meta = (ToolTip = "Part point value"))
int32 PointValue;
bool compatibleWithPart(int8 id);
UTowerPart(UTowerPart&);
UTowerPart();
};
/******************************************************************************/
Source
/******************************************************************************/
#include "TowerDefense.h"
#include "../../Main.h"
/******************************************************************************/
UTowerPart::UTowerPart(const class FPostConstructInitializeProperties& PCIP):Super(PCIP)
{
Id = -1;
Name = "";
Description = "";
LimitationDisallow = true;
Limitations.Empty();
Cost = 0;
PointValue = 0;
}
/******************************************************************************/
bool UTowerPart::compatibleWithPart(int8 id)
{
bool found = false;
FREP(Limitations.Num())
{
if(Limitations[i] == id)
{
found = true;
break;
}
}
return (LimitationDisallow != found);
}
/******************************************************************************/
I am using engine version 4.1.1