Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Blueprints reset variable values every compile

Using UE 4.23.1

Basically, i'm following a very simple tutorial. I've extended multiple base classes, and it seems in ANY of my extensions, the variables for all components (e.g., physics, collision, static mesh, etc) all reset EVERY TIME i do a full project compile.

For instance: I've extended UStaticMeshComponent with custom functionality (TankTrack). I set the static mesh component, and adjust the Collision to "Simulation GEnerates Hit Events". This sticks, but as soon as i recompile the entire game, EVERYTHING is reverted to its original state. Help!!

Note: This happens on variables I declare (and make UPROPERTY(EditAnywhere)) as well as those defaulted to that component type (e.g., Physics, collision, etc)

Here is an example with a UActorComponent called "Grabber". Only the .h file should matter if the issue is with blueprint?

If i change maxPickupWeightKg, then recompile, the change does NOT persist.

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "PhysicsEngine/PhysicsHandleComponent.h"
#include "Grabber.generated.h"


UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class FPSExample_API UGrabber : public UActorComponent
{
    GENERATED_BODY()

public: 
    // Sets default values for this component's properties
    UGrabber();

protected:
    // Called when the game starts
    virtual void BeginPlay() override;

public: 
    // Called every frame
    virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

    /// Grabber functions and variables
    UPROPERTY(EditAnywhere, Category = "Grab Setup")
        float maxPickupWeightKg = 50.f; 

};

.cpp Constructor is nothing fancy:

#include "Grabber.h"
#include "Math/UnrealMathUtility.h"
#include "CollisionQueryParams.h"
#include "Engine/EngineTypes.h"
#include "Engine/World.h"
#include "Components/ActorComponent.h"
#include "Components/PrimitiveComponent.h"
#include "GameFramework/Actor.h"

#define OUT

// Sets default values for this component's properties
UGrabber::UGrabber()
{
    PrimaryComponentTick.bCanEverTick = true;

}
.
.
.

My Hierarchy for the FPS Blueprint this is on:

FirstPersonCharacter(self)
-
CapsuleComponent (This is where all the player meshes are)
-
CharacterMovement
PhysicsHandle
Grabber

Thanks !

like image 773
stackdev Avatar asked Mar 24 '26 19:03

stackdev


1 Answers

Using 4.25.3 this has still not been fixed. My workaround is to create a child blueprint of the component and use that on my Actor. This way the property values do not get reset when compiling.

like image 101
Zcience Avatar answered Mar 26 '26 15:03

Zcience



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!