I know structs are messy and really fragile but this is really annoying and it really impacts my workflow. The issue is if you make a new struct in c++ and in blueprints make a variable using that struct and change the struct in c++ in any way whether it’s a new variable, different type, making the properties editable, the variables in BP get corrupted, and it’s not just variables, it corrupts any existing break or make nodes. But if you were to do everything in c++, everything is fine. I don’t want to do everything in c++ but I also don’t want to think everything I need before I implement for example what if a new feature was added and I need to update my code and use it in a struct, the entire project would pretty much be corrupted depending on how many references using the struct. I do hope this gets fixed in the future or there is a way to get around this.
What’s the stuct use for? Maybe there is a way around not using a struct.
I tend to use structs for storing lots of data, organization, and quick access. Rn I’m currently using structs in a save system plugin of mine to store object info like actors for example their class, transform, object name, etc and I also tend to use structs in tmaps or arrays because you cant have things like arrays nested inside an array or a tmap. I do usually find the need to edit the struct occasionally since I may have came up with a new variable to use that I need inside a struct. Hope this helps!
Could you possibly post just the struct itself?
Of course, I use structs like this in blueprints because I implement most of my code in my plugin in BP but for some things BP can’t handle I use c++.
USTRUCT(BlueprintType)
struct FActorStructure
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TSubclassOf<AActor> ActorClass;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TMap<FGuid, FComponentStructure> Components;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FGuid ActorID;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString ObjectName;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString LevelParent;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FGuid OwnerID;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FGuid AttachParentID;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FName AttachSocket;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FTransform ActorTransform;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FVector Velocity;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray<uint8> Variables;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float LifeSpan;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool bVisible;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FPawnStructure PawnStructure;
};
I’m actually not sure.
Does this happen only when you hot reload?
Make sure you don’t hot reload when altering definitions like .h files and structs etc. I learned this the hard way.
I was told by someone on Discord that I could use the experimental Live Coding feature, but if I do and I’m changing things like .h files, to instead quit Editor, build, then start my project editor back up from Visual Studio, not launcher
I converted my comment to an answer so you can accept it if you want. Let me know if it helps your situation, as I’m new to C++ in Unreal.