Questions in topic: "uproperty"https://answers.unrealengine.com/questions/topics/single/19575.html
The latest questions for the topic "uproperty"Can't seem to use UFUNCTION/UPROPERTY with UBlackboardComponenthttps://answers.unrealengine.com/questions/857248/cant-seem-to-use-ufunctionuproperty-with-ublackboa.html
I'm trying to expose either a variable or setter function for my UBlackboardComponent on a character, however any time I add a UFUNCTION/UPROPERTY to it my build files with errors like
error LNK2019: unresolved external symbol "__declspec(dllimport) class UClass * __cdecl Z_Construct_UClass_UBlackboardComponent_NoRegister(void)" (__imp_?Z_Construct_UClass_UBlackboardComponent_NoRegister@@YAPEAVUClass@@XZ) referenced in function "void __cdecl `dynamic initializer for 'public: static struct UE4CodeGen_Private::FObjectPropertyParams const Z_Construct_UClass_AVisitor_Statics::NewProp_Blackboard''(void)" (??__E?NewProp_Blackboard@Z_Construct_UClass_AVisitor_Statics@@2UFObjectPropertyParams@UE4CodeGen_Private@@B@@YAXXZ)
and
Binaries\Win64\UE4Editor-BYOC-4485.dll : fatal error LNK1120: 1 unresolved externals
If I remove the UFUNCTION/UPROPERTY from either a setter or variable, the error goes away and my code is just fine, so can I not expose something that uses a UBlackboardComponent to blueprints?c++upropertyblackboardufunctionlnk2019Wed, 12 Dec 2018 19:12:44 GMTsmtTSublassOf not found in c++https://answers.unrealengine.com/questions/841809/tsublassof-not-found-in-c.html
I've created a simple ActorComponent subclass with TSubclassOf UPROPERTY in c++. When I try to read this property in constructor it seems like it's not set, even though I've set this in a blueprint.
That's how things are set up:
.h:
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "ActiveSkills/BaseSkill.h"
#include "Includes.h"
#include "SkillSet.generated.h"
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class UNTITLEDGAME_API USkillSet : public UActorComponent
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
USkillSet();
// some other irrelevant methods her
protected:
UPROPERTY(EditAnywhere, Category = "Setup")
TSubclassOf<UBaseSkill> PrimarySkillClass;
};
.cpp (constructor only):
USkillSet::USkillSet()
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
// off to improve performance if you don't need them.
PrimaryComponentTick.bCanEverTick = false;
if(PrimarySkillClass.Get())
{
UE_LOG(LogTemp, Warning, TEXT("Creating skill"));
}
else
{
UE_LOG(LogTemp, Error, TEXT("No skill class"));
}
}
In actor that uses this component I've set a class:
![alt text][1]
And even then PrimarySkillClass.Get() evaluates to false and I get "No skill class" in logs. What am I doing wrong?
I'm using UE 4.20.2
[1]: /storage/temp/257947-eee.pngcomponentsupropertysubclassSun, 28 Oct 2018 20:22:16 GMTvrtexint型のUPROPERTYが初期化されない問題https://answers.unrealengine.com/questions/841000/int%E5%9E%8B%E3%81%AEuproperty%E3%81%8B%E5%88%9D%E6%9C%9F%E5%8C%96%E3%81%95%E3%82%8C%E3%81%AA%E3%81%84%E5%95%8F%E9%A1%8C.html
お世話になっております。
UPROPERTYを付いている変数の初期化について質問させて頂きます。
floatやint型の変数にUPROPERTYを付けると自動的に初期値に0が入りますのがこっちらの認識でしたけど、int型に関してはUPROPERTYに付けても初期化されずに不定の値が入ってしまいますので、それは正しい挙動なんでしょうが？
サンプルコードは下記通りです：
// テスト用構造体の定義
USTRUCT(BlueprintType)
struct FTestStruct
{
GENERATED_USTRUCT_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int TestValue1;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float TestValue2;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool TestValue3;
FTestStruct()
{
;
}
};
// テストコードの実行
FTestStruct testStruct;
UE_LOG(LogTemp, Log, TEXT("Initial Value of Test Value1: %d"), testStruct.TestValue1);
UE_LOG(LogTemp, Log, TEXT("Initial Value of Test Value2: %f"), testStruct.TestValue2);
UE_LOG(LogTemp, Log, TEXT("Initial Value of Test Value3: %d"), static_cast(testStruct.TestValue3));
上記コードを実行すると「Initial Value of Test Value1」のログが0以外の不定値に入ることを確認できます。
よろしくお願いいたします。unreal engine 4upropertyFri, 26 Oct 2018 10:57:18 GMTAnswers.ArchiveModifying the value of an FString in an array with reflection.https://answers.unrealengine.com/questions/830265/modifying-the-value-of-an-fstring-in-an-array-with.html
I'm using reflection to get a uproperty which is an array of strings using:
bool UFunctionLibrary::SetStringArrayElementByName(UObject * Target, FName VarName, int32 index, FString NewValue)
{
if (Target)
{
TArray<FString> FoundArray;
UArrayProperty* StringArray = FindField<UArrayProperty>(Target->GetClass(), VarName);
TArray<FString> outArray = *StringArray->ContainerPtrToValuePtr<TArray<FString>>(Target);
outArray[index] = NewValue;
This doesn't appear to modify the original array, however. What I'm trying to figure out, is how to change the value at _index_ to the value of the string _NewValue_
I've seen lots of posts about using _ContainerPtrToValuePtr_, and I've been able to return a modified array as a & parameter, but I can't figure out how to modify the original array property. I'm trying to create a generic string array editor.
I was greatly helped by this:
http://shootertutorial.com/2016/03/20/get-set-variables-by-name/
And ultimately, I'm trying to create a new _SetStringArrayElementByName_ UFUNCTION to take an index, target, a uproperty name, and a string value, and make the change.c++arrayreflectionupropertystringFri, 21 Sep 2018 11:59:04 GMTG_t_PianomanHow to create a slate widget for a UProperty of a UClass without the object instancehttps://answers.unrealengine.com/questions/829807/how-to-create-a-slate-widget-for-a-uproperty-of-a.html
I have the need to make a slate widget for a graph that allows me to see the UProperties of a UClass and to place a value for said UProperty.
I can't use the PropertyEditor since it seems to need the instance of the object, and I don't have that. I only have an UClass (Specifically a sub class, using TSubclassOf) and I can't make instances of it for various reasons.
I think I found in the blueprint structure editor an example of what I need (the default values table) but I couldn't understand how to replicate that.c++widgetslateupropertyuclassWed, 19 Sep 2018 17:13:19 GMTLazy_All UPROPERTY's resets after buildhttps://answers.unrealengine.com/questions/826497/all-upropertys-resets-after-build.html
I have some variables defined with macro UPROPERTY() in my cpp-based blueprint:
UPROPERTY(EditAnywhere)
TSubclassOf<UJournalWidget> journal_widget_bp;
UPROPERTY(EditAnywhere)
FSlateColor OriginalButtonColor;
// etc
And if I add new UPROPERTY() value and rebuild project, all properties resets to default (0 for pointers, default color for colors etc). (if I add non property value, of just change code it did not resets)
Its really annoying, anyting I can do with it?c++blueprintupropertySun, 09 Sep 2018 09:32:01 GMTalebasterUPROPERTY() TArray of UTexture2D is editable in the details panel, but remains empty in memoryhttps://answers.unrealengine.com/questions/820032/uproperty-tarray-of-utexture2d-is-editable-in-the.html
I have a TArray that I expose to the default editor of a custom UObject. The TArray is showing up in the details panel exactly as it should, but when I create breakpoints and check the values inside the Array, it is empty, no matter how many textures I add in the UI (See Screenshots).
Here is How I have the Array Declared:
UPROPERTY(Category=Custom, EditAnywhere, AssetRegistrySearchable, meta=(DisplayName="Textures"))
TArray<UTexture2D*> texs;
Is there perhaps some saving, or committing changes I have to do within the classes corresponding AssetActions Class?
Edit: Realized I wasn't constructing the TArray before trying to use it, and thought that that may be problem. However, Now I initialize the TArray when this Object is Constructed, and it's still empty no matter what I add in the Details Panel.
![alt text][1]
![alt text][2]
[1]: /storage/temp/251105-detailspanetexs.png
[2]: /storage/temp/251106-invalidtexs.pngeditortexturematerials & texturesupropertydetails panelTue, 21 Aug 2018 00:04:59 GMTkobenaClass members marked with UPROPERTY() not showing up in Details Panehttps://answers.unrealengine.com/questions/818694/class-members-marked-with-uproperty-not-showing-up.html
I have a `class` that `subclasses` `UMaterialInstanceConstant`. I am trying to add a `UPROPERTY` that is a `TArray<UTexture2D>`. I have added it to the `class` how I have added every other `UPROPERTY` in my time working with Unreal, but for some reason, this will not appear in the Details pane. The functionality I'm trying to achieve is the user opens the editor for this Custom Material Instance, and Is able to select 1 or more textures to store in this `TArray`.
MaterialInstance:
UCLASS()
class UCustomMaterialInstance : public UMaterialInstanceConstant
{
public:
GENERATED_UCLASS_BODY()
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = MaterialEditorInstanceConstant)
TArray<UTexture2D> texs;
void Load();
void Save();
friend class UCustomMaterialInstanceFactoryNew;
};
Factory and AssetActions `Classes` work as they should, but I suspect the culprit could lie in the follow AssetActions `Function`:
void FAssetTypeActions_CustomMaterialInstance::OpenAssetEditor(const TArray<UObject*>& InObjects, TSharedPtr<IToolkitHost> EditWithinLevelEditor)
{
EToolkitMode::Type Mode = EditWithinLevelEditor.IsValid() ? EToolkitMode::WorldCentric : EToolkitMode::Standalone;
for (auto ObjIt = InObjects.CreateConstIterator(); ObjIt; ++ObjIt)
{
auto MIC = Cast<UMaterialInstanceConstant>(*ObjIt);
if (MIC != NULL)
{
IMaterialEditorModule* MaterialEditorModule = &FModuleManager::LoadModuleChecked<IMaterialEditorModule>("MaterialEditor");
MaterialEditorModule->CreateMaterialInstanceEditor(Mode, EditWithinLevelEditor, MIC);
}
}
}
I believe that this may be happening because I am loading the "Material Editor", rather than some custom asset editor, but I doubt it because I am passing in the object with the UPROPERTYies at the end, so the editor should be aware of these properties and dynamically create the details view.c++pluginsupropertydetails panelmoduleThu, 16 Aug 2018 03:46:55 GMTkobenaUnrecognized type xxx type must be a UCLASS, USTRUCT or UENUMhttps://answers.unrealengine.com/questions/816590/unrecognized-type-xxx-type-must-be-a-uclass-ustruc.html
Hello, I seem be missing something as there seems to be issue with blueprint structs in c++
for example if I have struct that required before another struct I keep getting error.
Unrecognized type xxx type must be a UCLASS, USTRUCT or UENUM
/** TextObject */
USTRUCT()
struct FCreditsTextObjectAdvanced : public FTableRowBase
{
GENERATED_USTRUCT_BODY()
/** Credits text properties text */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Credits)
FCreditsTextProperties TextProperties; // Blueprints/Structs/Backend/TextProperties
/** Credits text properties text */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Credits)
FCreditsImageProperties ImageProperties; // Blueprints/Structs/Backend/ImageProperties
/** Credits text properties text */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Credits)
FCreditsPaddingMarginProperties PaddingProperties; // Blueprints/Structs/Backend/PaddingMargin
};
but then if the FCreditsTextProperties is called after the above struct I keep getting that error. causing chicken and egg scenario.
I not sure how to fix this as rearranging the code is not the answer as the plan originally was to move the backend structs and default structs to there own files.blueprintsc++structupropertyustructThu, 09 Aug 2018 13:38:20 GMTdazzlesoftwareCan UPROPERTY be a private member?https://answers.unrealengine.com/questions/815046/can-uproperty-be-a-private-member.html
Below is an example header file of using UPROPERTY on a private member variable.
This header file seems to work, but I did run into a one-time bug where this particular component stopped saving changes to anything in the details window (the blueprint compile button wouldn't change to "needs to be compiled" regardless of any setting changed on this component). Deleting the component and re-adding it fixed the problem and changes could be made again, but I wasn't able to reproduce the bug after that. Since I couldn't reproduce the bug, I couldn't deduce if using UPROPERTY on the private member was the cause or not.
So I'm wondering: Is it safe to use UPROPERTY on a private member or do they have to be protected instead?
#pragma once
#include "CoreMinimal.h"
#include "Components/StaticMeshComponent.h"
#include "TankBarrel.generated.h"
UCLASS(meta = (BlueprintSpawnableComponent))
class BATTLETANK_API UTankBarrel : public UStaticMeshComponent
{
GENERATED_BODY()
public:
void Elevate(float relativeSpeed);
private:
UPROPERTY(EditAnywhere, Category = Setup)
float MaxDegreesPerSecond = 20;
UPROPERTY(EditAnywhere, Category = Setup)
float MaxElevationDegrees = 40;
UPROPERTY(EditAnywhere, Category = Setup)
float MinElevationDegrees = 0;
};blueprintsc++upropertySat, 04 Aug 2018 16:48:06 GMTDisastercakeProcedurally set EditAnywhere (UPROPERTY)https://answers.unrealengine.com/questions/813103/procedurally-set-editanywhere-uproperty.html
[> please also see related forum post][1]
How do I set a dynamically spawned Component/Actor to EditAnywhere if I cannot use the UPROPERTY() macro, since this is purely runtime based from c++.
I want to spawn a child actor via UChildActorComponent, which works to some extent. But the spawned child actor is not editable or selectable in the World Outliner or Editor Viewport. But setting a UPROPERTY() macro is not possible since the actor and UChildActorComponents are spawned at runtime and I do not have class attribute where I could put the UPROPERTY() macro. So I need to be able to set an Actor/Component to EditAnywhere purely from C++ at runtime. How do I do this=
UChildActorComponent* NewComp1 = NewObject<UChildActorComponent>(this);
NewComp1->bEditableWhenInherited = true;
NewComp1->RegisterComponent();
NewComp1->SetChildActorClass(AMyChildActor::StaticClass());
NewComp1->CreateChildActor();
Related, but not answered / working:
["> How to add UPROPERTY dynamically?"][2]
[1]: https://forums.unrealengine.com/development-discussion/c-gameplay-programming/1508119-creating-child-actors-properly
[2]: https://answers.unrealengine.com/questions/202222/how-to-add-uproperty-dynamically.htmlc++proceduralruntimeupropertydynamicSun, 29 Jul 2018 20:22:32 GMTchrarlaitExtending AActor shows neither components nor propertieshttps://answers.unrealengine.com/questions/811880/extending-aactor-shows-neither-components-nor-prop.html
Hi everyone,
I'm currently trying to implement a custom actor class with UE4.20, but I'm having quite a few issues with that.
Beside the tutorials and examples often missing includes or just telling "hey, just use this code [...]" without telling where the code is intended to be called so far nothing seems to be working as expected.
For this concrete example I'm using https://docs.unrealengine.com/en-us/Programming/Tutorials/Components/1 and https://gist.github.com/Chaosed0/4a378922ede069bb20d6 as references. (I read through a lot of related articles on google about this, but I'm not going to list them all here)
So my class currently looks like this:
**OrbActor.h**
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Engine/StaticMesh.h"
#include "Engine/Classes/Components/SphereComponent.h"
#include "Engine/Classes/Components/StaticMeshComponent.h"
#include "ConstructorHelpers.h"
#include "OrbActor.generated.h"
UCLASS()
class SPACEEXPLORER_API AOrbActor : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AOrbActor(const FObjectInitializer& ObjectInitializer);
/** Radius of the orb. */
UPROPERTY(EditAnywhere)
float OrbRadius;
/** Physics component of the orb. */
UPROPERTY(EditAnywhere)
class USphereComponent* OrbPhysics;
/** Static mesh component of the orb. */
UPROPERTY(EditAnywhere)
class UStaticMeshComponent* OrbMesh;
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
};
**OrbActor.cpp**
// Fill out your copyright notice in the Description page of Project Settings.
#include "OrbActor.h"
// Sets default values
AOrbActor::AOrbActor(const FObjectInitializer& ObjectInitializer)
{
// Default property values
OrbRadius = 1.0f;
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
// Create physics component
OrbPhysics = CreateDefaultSubobject<USphereComponent>(TEXT("RootComponent"));
RootComponent = OrbPhysics;
//OrbPhysics->SetupAttachment(RootComponent);
// Create static mesh component
OrbMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("VisualRepresentation"));
OrbMesh->SetupAttachment(RootComponent);
static ConstructorHelpers::FObjectFinder<UStaticMesh> SphereVisualAsset(TEXT("/Game/StarterContent/Shapes/Shape_Sphere.Shape_Sphere"));
if (SphereVisualAsset.Succeeded())
{
OrbMesh->SetStaticMesh(SphereVisualAsset.Object);
OrbMesh->SetRelativeLocation(FVector(0.0f, 0.0f, 0.0f));
OrbMesh->SetWorldScale3D(FVector(OrbRadius));
}
}
// Called when the game starts or when spawned
void AOrbActor::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AOrbActor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
The code as shown compiles fine (tried both starting the compile in Visual Studio or the UE-Editor), but as a result when adding the actor it will neither show the sub components, neither any of the defined UPROPERTY fields. What am I getting wrong here?
Any help would be greatly appreciated.
Edit: Forgot to attach the screenshot of the result:
![alt text][1]
[1]: /storage/temp/248506-screen1.pngunreal engine 4c++actorupropertyadd componentWed, 25 Jul 2018 18:25:11 GMTForsakenNGSUPROPERTY is nullhttps://answers.unrealengine.com/questions/810863/uproperty-is-null.html
Hi guys,
I'm trying to pass to a class that extends UButton a TSubclassOf UPROPERTY that points to a BP class. I then use this UPROPERTY to construct an instance through NewObject.
The problem I am having right now is that for some reason, at runtime the TSubclassOf is NULL and I don't understand why. I guess it's something really simple specific to UE4.
Could you have a look and let me know if you spot what I am doing wrong?
---
This is the (base) class of the classes that should be referenced by TSubclassOf.
// BBEvent.h
class UBBEvent;
class ABBHUD;
DECLARE_EVENT_OneParam(UBBEvent, FBBEvent, UBBEvent *)
UCLASS(Blueprintable, BlueprintType, DefaultToInstanced)
class SALTLAKECITY_API UBBEvent : public UObject
{
GENERATED_BODY()
...
};
This is the class that contains the UPROPERTY.
//BBButton.h
class UBBEvent;
UCLASS()
class SALTLAKECITY_API UBBButton : public UButton
{
GENERATED_BODY()
public:
UBBButton(const FObjectInitializer & ObjectInitializer);
virtual void PostInitProperties() override;
...
protected:
UPROPERTY(Category = "Event Handler", BlueprintReadWrite, EditAnywhere, meta = (AllowPrivateAccess = "true"))
TSubclassOf<UBBEvent> EventHandlerTemplate;
UPROPERTY()
UBBEvent * EventHandler;
};
This is how I try to use the UPROPERTY:
// BBButton.cpp
...
void UBBButton::PostInitProperties()
{
Super::PostInitProperties();
if (EventHandlerTemplate)
{
UE_LOG(LogTemp, Warning, TEXT("EventHandlerTemplate is not NULL"));
EventHandler = NewObject<UBBEvent>(this, EventHandlerTemplate);
}
OnClicked.AddDynamic(this, &UBBButton::NotifyEventHandler);
}
...upropertynulltsubclassofnewobjectSun, 22 Jul 2018 09:46:09 GMTVetrilExpose C++ UProperty to sequencer?https://answers.unrealengine.com/questions/808892/expose-c-uproperty-to-sequencer.html
I can't find any information on how to expose a Blueprint UProperty defined in C++ to a sequence so that you can add a track for it. I assume there is a metadata property, parallel to ExposeOnSpawn, that would implement the same functionality as the Expose To Cinematic checkbox in the Blueprint editor. I have searched a bunch and had no luck, so any help is appreciated.c++sequencerupropertycinematicSun, 15 Jul 2018 21:29:26 GMTskweetis_meta = (BindWidget) error in second extensionhttps://answers.unrealengine.com/questions/804391/meta-bindwidget-error-in-second-extension.html
I've set a meta = (BindWidget) variable and binded in blueprint. Now I want to extend that Blueprint again but I keep getting required widget binding missing, even though I binded it in the parent class. Any ideas someone?blueprintumgupropertycppSat, 30 Jun 2018 13:26:24 GMTpasoteeAccess UObject Property as Blueprint Variablehttps://answers.unrealengine.com/questions/802724/access-uobject-property-as-blueprint-variable.html
Hi,
the scenario looks like this: I have a gamemode blueprint in which I want to handle some core mechanics in C++ classes. Those classes are inheriting from UObject and are used as variables in the gamemode blueprint.
The question: how can I access the properties of my classes?
I have no issues calling UFUNCTION functions of my class within the blueprint but I don't seem to find a way to access the properties.
Any ideas?
EDIT:
Ok, after checking again, I've noticed that the properties can be changed using setters and getters. However, I'ld still appreciate a way to set the default (init) value.
Cheersblueprintsc++upropertyuobjectgamemodeSun, 24 Jun 2018 13:16:05 GMTWRodewaldCannot save Map with C++ EditDefaultsOnlyhttps://answers.unrealengine.com/questions/801784/cannot-save-map-with-c-class.html
when using Uproperty EditDefaultsOnly it prevents me from saving when I have an actor with it in the map as seen in the class bellow. I have a feeling I am missing something that would make this work but I cannot find what it is.
UCLASS()
class CHIEFSOFMISCHIEF_API AWorldActor : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AWorldActor();
AWorldActor(UInventoryObject* itemRef);
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
void SetItemType(EItemTypeEnum type = EItemTypeEnum::IT_NONE);
void SetItem(UInventoryObject* item);
UPROPERTY(Replicated, BlueprintReadOnly, Category = "Location")
FVector WorldLocation;
UPROPERTY(Replicated, BlueprintReadOnly, Category = "Location")
FRotator WorldRotation;
void UpdateWorldPos();
void SetWorldPosRot(FVector pos, FRotator rot);
public:
UPROPERTY(EditDefaultsOnly, Category = "Default")
TSubclassOf<UInventoryObject> ItemClassRef;
// Called every frame
virtual void Tick(float DeltaTime) override;
UFUNCTION(BlueprintCallable, BlueprintPure)
EItemTypeEnum GetItemType();
UPROPERTY(Replicated, BlueprintReadOnly, Category = "Info")
UInventoryObject* ItemReference;
};
this is the class it is referencing:
UENUM(BlueprintType)
enum class EItemTypeEnum : uint8 {
IT_NONE UMETA(DisplayName = "None"),
IT_Weapon UMETA(DisplayName = "Weapon")
};
/**
*
*/
UCLASS(Blueprintable)
class CHIEFSOFMISCHIEF_API UInventoryObject : public UObject
{
GENERATED_BODY()
public:
UPROPERTY(BlueprintReadOnly, Category = "Info")
EItemTypeEnum ItemType = EItemTypeEnum::IT_NONE;
};c++saveupropertyumapWed, 20 Jun 2018 23:49:31 GMTChiefOfMischiefCan't edit UPROPERTY from blueprint parented by classhttps://answers.unrealengine.com/questions/792665/cant-edit-uproperty-from-blueprint-parented-by-cla.html
Hi. I've been struggling with this for a few days now, and haven't found help in previous forum posts or the mighty google.
I added a new public member variable as a UPROPERTY to my character base class, which derives from ACharacter.
/** Player running speed. */
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Movement)
float RunningSpeed;
When I go to the blueprint I already derive from this class in the Editor, I can see this value as read-only with a default, but cannot edit it with any combination of flags that I've tried. I've attempted making the class Blueprintable, adding [meta=(AllowPrivateAccess = "true")] to the UPROPERTY, which seems unrelated since my variable is already public but still didn't solve anything.
This is the simplest case, but I have the exact same issue when I try to add new ActorComponents to blueprints as well and mess with the UPROPERTY flags in the same way, nothing can be edited in the defaults.
Am I missing something simple? If not, I feel like there was a shift in thinking that happened to the engine since I used it last, but none of the docs seem to point me towards what that is. Halp plz, this kinda blocks me from doing anything fun.unreal engine 4c++upropertyinheritanceWed, 23 May 2018 06:14:23 GMTRyanTylerRaeUPROPERTY ERRORS: Member Variable declaration: Missing variable typehttps://answers.unrealengine.com/questions/792534/uproperty-errors-member-variable-declaration-missi.html
![alt text][1]
[1]: /storage/temp/241847-error-list-vs.png
If I don't put the semicolon ';' at the end of UPROPRETY I get this errors (IN THE IMAGE).
If I put the semicolon at the end of:
UPROPERTY(EditAnywhere, Category = "Component");
I just get 2 errors:
1-Member Variable declaration: Missing variable type
2-The Command ""F:\...." -WaitMutex- FromMsBuild" exited code 5. Please verify that you have sufficient rights to run this command
And there are all caused by UPROPERTY apparentlyunreal engine 4c++errorupropertyTue, 22 May 2018 18:58:32 GMTMatty37_TArray of AActor children in GameMode as UPROPERTYhttps://answers.unrealengine.com/questions/791699/tarray-of-aactor-children-in-gamemode-as-uproperty.html
Hello
In my GameMode.h file I've got a following declaration:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray<APlanet*> Planets;
Where APlanet is class inheriting after AActor.
I've created a blueprint class based on my GameMode.h, and I wanted to set some instances of APlanet in my level, as elements of Planets array. Clicking on + sign works and adds an element, but when I choose an instance from the dropdown, it's still showing None.
Do I need any other UPROPERTY things to make it work?
The instances are not created in main level, may it be a problem?c++editorupropertytarraySun, 20 May 2018 10:52:26 GMTCansistiC++ Cant' modify struct Component in details/viewport panelhttps://answers.unrealengine.com/questions/788174/c-cant-modify-struct-component-in-detailsviewport.html
Hey guys,
I'm trying to do something really simple, I have a struct with some component that I create in my constructor and attach it to the root. No problem so far, everything is created and moved in the origin of my Root. But When I go into my blueprint to move those component manually, I can't access them.
USTRUCT(BlueprintType)
struct XROAD_API FXRoadVehicleSeat
{
GENERATED_USTRUCT_BODY()
public:
FXRoadVehicleSeat() {}
FXRoadVehicleSeat(UBoxComponent* LocalDoorInteractionCollision,
UArrowComponent* LocalExitVehicleArrow,
EDoorPosition LocalDoorPosition,
FName LocalSocketName,
AXRoadPedestrian * LocalPedestrianOnTheSeat = NULL)
{
DoorInteractionCollision = LocalDoorInteractionCollision;
ExitVehicleArrow = LocalExitVehicleArrow;
DoorPosition = LocalDoorPosition;
SocketName = LocalSocketName;
PedestrianOnTheSeat = LocalPedestrianOnTheSeat;
}
public:
UPROPERTY(BlueprintReadWrite, VisibleAnywhere, meta = (AllowPrivateAccess = "true"), Category = "XROAD|Vehicle|Seats")
UBoxComponent * DoorInteractionCollision;
UPROPERTY(BlueprintReadWrite, VisibleAnywhere, meta = (AllowPrivateAccess = "true"), Category = "XROAD|Vehicle|Seats")
UArrowComponent * ExitVehicleArrow;
UPROPERTY(EditAnywhere, meta = (AllowPrivateAccess = "true"), Category = "XROAD|Vehicle|Seats")
EDoorPosition DoorPosition;
UPROPERTY(EditAnywhere, meta = (AllowPrivateAccess = "true"), Category = "XROAD|Vehicle|Seats")
FName SocketName;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "XROAD|Vehicle|Doors")
AXRoadPedestrian * PedestrianOnTheSeat;
UPROPERTY(BlueprintReadOnly, Category = "XROAD|Vehicle|Seats")
bool bIsDriverSeat;
};
This is my stucture containing my two component I want to modify.
// Seats properties
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "XROAD|Vehicle|Interaction")
TArray<FXRoadVehicleSeat> VehicleSeats;
Here is my declaration of FXRoadVehicleSeat
AXRoadVehicle4W::AXRoadVehicle4W(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
// Camera Setup
// Create our FPS Arm spring component
FPSCameraSpringArm = CreateDefaultSubobject<USpringArmComponent>(TEXT("FPSCameraSpringArm"));
FPSCameraSpringArm->SetupAttachment(RootComponent);
FPSCameraSpringArm->SetRelativeLocationAndRotation(FVector(0.0f, -32.0f, 128.0f), FRotator(0.0f, -5.0f, 0.0f));
FPSCameraSpringArm->TargetArmLength = 0.0f;
FPSCameraSpringArm->bEnableCameraLag = false;
// Create our TPS Arm spring component
TPSCameraSpringArm = CreateDefaultSubobject<USpringArmComponent>(TEXT("TPSCameraSpringArm"));
TPSCameraSpringArm->SetupAttachment(RootComponent);
TPSCameraSpringArm->SetRelativeLocationAndRotation(FVector(2.6f, 0.0f, 130.0f), FRotator(-15.0f, 0.0f, 0.0f));
TPSCameraSpringArm->TargetArmLength = 400.0f;
TPSCameraSpringArm->bEnableCameraLag = false;
// Create the camera and attach it to the fps arm
VehicleCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("GameCamera"));
VehicleCamera->SetupAttachment(FPSCameraSpringArm, USpringArmComponent::SocketName);
VehicleCamera->SetRelativeLocationAndRotation(FVector(0.0f, 0.0f, 0.0f), FRotator(0.0f, 0.0f, 0.0f));
// Setup Vehicle Seats
NumberOfSeats = 4;
for (int i = 0; i < NumberOfSeats; ++i)
{
// Door Collision
UBoxComponent * Collision = CreateDefaultSubobject<UBoxComponent>(FName(*FString(GETENUMSTRING("EDoorPosition", (EDoorPosition)i) + "_Collision")));
Collision->SetupAttachment(RootComponent);
// Exit Arrow for the pedestrian
UArrowComponent * ExitVehicleArrow = CreateDefaultSubobject<UArrowComponent>(*FString("ExitArrow_" + FString::FromInt(i)));
ExitVehicleArrow->SetupAttachment(Collision);
VehicleSeats.Add(FXRoadVehicleSeat(Collision,
ExitVehicleArrow,
(EDoorPosition)i,
FName(*(GETENUMSTRING("EDoorPosition", (EDoorPosition)i))),
NULL));
}
// Setup Anim Instance
if (Mesh != NULL)
{
AnimationVehicle = Cast<UDcxVehicleAnimInstance>(Mesh->GetAnimInstance());
if (AnimationVehicle != NULL)
{
AnimationVehicle->SteeringWheelAngle = 0.0f;
}
}
}
And finally my constructor where I initialize every Component.
![alt text][1]
Here is the result of this code. I still can't access them, but if I'm putting them outside a struct It's working as intended, I can modify them manually. So my question is what I am doing wrong, I put VisibleAnywhere or EditAnywhere for my component and even BlueprintReadWrite but I still can't have any control over them in my Viewport or details panel.
Any feedback is welcome! Thanks!
[1]: /storage/temp/240437-citroendetails.pngcomponentsstructupropertyinitializationdeclaringWed, 09 May 2018 11:51:48 GMTKvyoshUPROPERTY not editable in editorhttps://answers.unrealengine.com/questions/784292/uproperty-not-editable-in-editor.html
Hi everyone. I am currently working on some C++ and Blueprint classes that inherit from them. A very strange bug occurred during this process and I hope you have some solution for it.
1. I have created a C++ base class "Building" that has a UPROPERTY(VisibleAnywhere) UStaticMeshComponent. (The BlueprintReadWrite specifier is just for testing but without it the behavior is the same)
2. I have created some Blueprints that have the "Building" as parent and set the corresponding Meshes.
This worked fine for a while. Now I have reopened the editor and wanted to change some meshes but I see no options and parameters in "Details" view anymore. Thus I cannot change anything anymore :(
When I rename my variable e.g. form "BuildingMesh" to "BuildingMeshX" than the options show up again but I have to setup everything again. Renaming back to "BuildingMesh" _hides_ the options again.
Further when I create a new BP that parents "Building" everything looks fine and I can edit it but the _old_ BPs are not configurable.
This is very strange and annoying since I don't want to set up everything again and again when this bug occurs. How to handle this issue? Is there a work around?
I have attached some screenshots to show you what I mean.
![Code][1]
![Editor][2]
[1]: /storage/temp/239142-code.png
[2]: /storage/temp/239143-editor.pngblueprintsc++bug reporteditorupropertySat, 28 Apr 2018 15:06:37 GMTDBulczakError when trying to use float pointers?https://answers.unrealengine.com/questions/773882/error-when-trying-to-use-float-pointers.html
I got this problem in my code. I try to make a pointer to a float so i can add the reference to in the editor.
UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
class MYPART_API UMyActorComponent : public UActorComponent
{
//...
public:
//The direction of the character
UPROPERTY(EditAnywhere)
float * direction = nullptr;
//Player to follow
UPROPERTY(EditAnywhere)
AActor * player = nullptr;
};
All the header code:
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "MyActorComponent.generated.h"
UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
class MYPART_API UMyActorComponent : public UActorComponent
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
UMyActorComponent();
protected:
// Called when the game starts
virtual void BeginPlay() override;
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
public:
//The direction of the character
UPROPERTY(EditAnywhere)
float * direction = nullptr;
//Player to follow
UPROPERTY(EditAnywhere)
AActor * player = nullptr;
};
Comes with the error:
> Inappropriate '*' on variable of type
> 'float', cannot have an exposed
> pointer to this type.
I just want a simple float pointer... why?!
Has it something to do with how UPROPERTY works?upropertypointerpointersThu, 29 Mar 2018 14:17:00 GMTILikeBananaPieCan't add elements to TArrayhttps://answers.unrealengine.com/questions/766571/cant-add-elements-to-tarray.html
I'm creating a TArray and using it as a UPROPERTY. When I try to add any element it just doesn't work.
Is it because of the UPROPERTY? How can I make it?
I'm using this structure:
UPROPERTY(BlueprintReadOnly, EditAnywhere)
TArray MyArray;
MyArray.Add (TEXT("INSERT"));c++arrayprogrammingupropertytarrayThu, 08 Mar 2018 13:08:42 GMTTabacudoDetails Panel: How to remove categories from a Componenthttps://answers.unrealengine.com/questions/765636/details-panel-how-to-remove-categories-from-a-comp.html
I found hideCategories for the UCLASS() however I have the following:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly )
USkeletalMeshComponent* MeshComponent;
and I want to hide all categories dealing with the SkeletalMeshComponent **EXCEPT** for "Mesh".
Can't find anything on the API so I'm hoping I'm just missing something.
Thanks!upropertydetails panelhideuclasshidecategoriesMon, 05 Mar 2018 22:24:02 GMTMarsh LeflerCan I have a TUnion as a UProperty?https://answers.unrealengine.com/questions/765522/can-i-have-a-tunion-as-a-uproperty.html
I have tried adding a TUnion type to a C++ class and marking it as a UProperty. This fails to compile. Is there any way to make this work? If not, what do I need to be aware of if this variable is left as a non-UProperty?c++upropertyMon, 05 Mar 2018 17:03:31 GMTjonnybolton42EyeDropper from scene isnt workinghttps://answers.unrealengine.com/questions/765342/eyedropper-from-scene-isnt-working.html
I made a UPROPERTY and added the Specifiers and Metadata to make it Class picker. It compiles fine no error and the search has the 2 spot lights in the world inside the editor and they are added when i click on it but when i try to use the Eyedropper Class picker it doesnt work. Am i missing something?![alt text][1]
UPROPERTY(EditAnywhere, Category = "SpotLight", meta = (AllowedClasses = ASpotLight, ExactClass = true))
ASpotLight* SpotlightPicker;
[1]: /storage/temp/232773-screenshot-186-li.jpgc++helpactorprogrammingupropertyMon, 05 Mar 2018 07:41:38 GMTShadowjonnyIssue getting index of TArrayhttps://answers.unrealengine.com/questions/764778/issue-getting-index-of-tarray.html
// In Header Class
UPROPERTY(EditAnywhere, Category = "Movement")
TArray<FVector> locations;
// In cpp Class
FVector variable = locations[0]; // Error is thrown here
I don't do anything else other than fill the TArray, "locations", from within UE4 and I receive the error "Array Index out of bounds" when attempting to obtain data from the TArray.
Thanks for any help you can provide.upropertytarrayindex of out boundsSat, 03 Mar 2018 06:06:55 GMTAtijafAHUD Uproperty not visible in editorhttps://answers.unrealengine.com/questions/763569/ahud-uproperty-not-visible-in-editor.html
Hi Everyone,
I'm trying to figure out how to make an Uproperty in a custom AHUD class to become visible in Editor.
Unfortunatelly, I have not found any answer about this question or any similar problem. My intent is to edit this variable in editor to inform an string.
UCLASS()
class ARENAPROJECT_API AHtmlHUD : public AHUD
{
GENERATED_BODY()
public:
AHtmlHUD();
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="HUD Properties")
FString SPAUrl;
};
Thankshudc++ programmingupropertypropertiesWed, 28 Feb 2018 03:23:46 GMTGeversonUPROPERTY meta specifier not workinghttps://answers.unrealengine.com/questions/759434/uproperty-meta-specifier-not-working.html
Hi all,
I have an implementation problem with meta specifiers apparently in VS 2017 with UE 4.18.
I am also using Visual Assist.
I'm just getting into C++ and this is the first time I've tried to use the meta specifier for a UPROPERTY.
My implementation doesn't recognize meta specifier (doesn't highlight properly), and then i get these compile errors.
I discovered this while doing a tutorial. The instructors implementation worked fine. I think he is using VS 2015 though.
would a kind soul clue me in on what might be wrong with my implementation?
(Not highlighting properly)
![alt text][1]
[1]: /storage/temp/230932-metatagissue.jpg
Errors:
... error : Expected a metadata key
... -waitmutex" exited with code 5. Please verify that you have sufficient rights to run this command.
If I remove the meta specifier everything compiles fine.upropertyimplementationmetaspecifierFri, 16 Feb 2018 20:16:24 GMTMagicBots