Editing code causes blueprint to break

Heloo,

this drives me crazy. I have C++ class AHumanFighter and blueprint which derives from it BP_HumanFighter. It often happens that when I edit AHumanFighter code my blueprint breaks and no longer compiles. What is espacially wierd is that part that breaks have nothing to do with changes I make! Just right now I was cleaning some code, not really adding anything new and suddenly my rocket firing logic breaks and I need to fix blueprint.

You guys have the same problems? What is causing them?

cheers

Hello ,

I’d like to help you find out why this is occurring. Can you give me some examples of what errors you’re receiving about the blueprint being broken? What type of code are you editing when this occurs?

Hello ,

We haven’t heard from you in a while. Are you still experiencing these problems? If so, please let me know and we can continue looking into this issue. In the meantime, I’ll be setting this issue to resolved for tracking purposes.

Hi ,

problem with this is that it happens randomly and it is hard for me to give You any repro steps. But this definitively is happening and is very annoying. Today I will try to tweak a little with my project and see if I can give You any tips as to when this happens and how to make it happen so stay tuned :wink:

cheers :wink:

Hi ,

I’ve just succeded in reproducing this. In my code I’ve defined custom enum, EActiveSkillType:

UENUM(BlueprintType)		//"BlueprintType" is essential to include
enum class EUnitSkillType : uint8
{
	LASER	UMETA(DisplayName = "Laser"),
	ROCKET  UMETA(DisplayName = "Rocket")
};

extern EUnitSkillType DEFAULT_SKILL;

I use this type in my blueprints. For example in one of my blueprints I’have added variable of this type. Variable is called AtiveSkill. I am using this variable and blueprint works and compiles OK.

Then I edit my C++ code by adding this funtion (Madafakaaaa) to one of my classes:

LaserShot.h:

    UCLASS()
    class MYPROJECT4_API ALaserShot : public AActor
    {
    	GENERATED_BODY()
    
    public:
    
    	ALaserShot();
    
    	... // some code
    
    	UFUNCTION(BlueprintCallable, Category = "Default")
    	FVector Madafakaaaaa(const ALaserShot*  asdf, EUnitSkillType adf);
    
            ... // some code
    };

LaserShot.cpp:

#include "MyProject4.h" 
#include "LaserShot.h"

... // some code 

FVector ALaserShot::Madafakaaaaa(const ALaserShot* asdf, EUnitSkillType adf)
{
	return FVector::ZeroVector;
}

And I compile. After I compile and project Hot Reload’s all variables (in EVERY blueprint ) with type EUnitSkillType change it’s type to byte and blueprint doesn’t compile. I need to fix it manually by changing variables type to EUnitSkillType again.

Screenshot from one of not compiling blueprints:
57027-

I believe there may be some missing steps in what you provided as I’m not getting the same result. To be exact, heres what I did:

  • Created a new blank C++ project.
  • Added a new C++ class based off Actor.
  • Copied the code you provided and plugged it in at the right places.
  • Compiled and then created a blueprint based off the new C++ class.
  • Created a variable of the EUnitSkillType type and created a function that set its value.
  • Saw that this involved hot reloading so added another variable to the C++ class just to compile and hot reload.

At this point, you mentioned that the variable changed to the byte type by itself. I did not experience this which could be part of why I’m also not experiencing the errors with compiling.