Download

My Blueprint Nightmare (possible bug)

UPDATE: The issue came back again. If my PlayerControllerBP has a Cast to <BP derived from CharacterBP>, it nulls out the mesh. As soon as I remove that cast, it fixes it.

UPDATE 2:
They were able to reproduce the bug, and in my case it was due to a circular dependency:

ORIGINAL:
I figured I’d share a bit of a nightmare I went through recently with blueprints. I’m on 4.5, and I don’t remember if I tested this in 4.4, but I spent maybe 12 hours trying to understand a problem I came across.

The problem: Game works like a charm in editor and editor launched standalone. I packaged a development build, and before sending it out, I tested that build. Welp, game was no longer working like a charm. My character blueprint was completely broken in the packaged version of the game.

The… the cause? I spent maybe 4 hours trying to figure out what was going on, and as I delved deeper into the problem which I began to suspect less and less was my fault. I discovered that when I removed any blueprint paths to nodes referencing my character blueprint (like Cast to MyCharacterBP or Find All of Class), the character worked. Note that these nodes weren’t even being executed when the character was broken. The mere fact they that they were being compiled was wrecking the packaged version of the blueprint they referenced.

So at that point I’m pretty certain it’s Epic’s fault because these blueprints had worked before in package release yet all my changes were pretty much innocuous. What I needed to know is what I had done that brought about this issue so I could avoid it in the future. I went back to previous commits and started packaging my game at every commit to see where things went south. I found the commit, started diffing blueprints and C++, and began removing other changes in it, changes that shouldn’t really have had any effect on my blueprint (I list them below), and it turns out they didn’t. So I had the commit but after going through most every change, I was about to give up.

Anyway, while trying to fix this issue by simply cleaning up my blueprints, I had discovered my blueprint’s context menu wasn’t giving me all the functions I should have access to. So I googled that issue and discovered this https://answers.unrealengine.com/questions/111211/having-lots-of-problems-with-blueprint-context-men.html ask thread. At this point I was only trying to fix the blueprints context menu, and Ben’s response to turn on the experimental menuing system did in fact fix the context menu for me. I then repackaged the game - not because I thought the menu would fix it but because at this point I had been repackaging on every change.

And completely unexpectedly my character blueprint was working again in the packaged game… with references to the class still in use in the blueprint. I immediately tried to re-break my character blueprint by disabling the experimental menuing system, but this time the character still worked in the packaged release.

The only thing I think could have happened was: I turned on experimental menuing at some point to test it, and then went back to the legacy system. Doing this somehow messed with the integrity of blueprint compilation (honestly this sounds like total nonsense to me, but it’s the only idea I have right now), and when I switched back to the experimental menuing system again it corrected whatever was wrong with blueprint compilation before.

What my bad commit included (possibly irrelevant):

  • I changed the header file that my blueprint’s parent blueprint derives from. So MyCharacterBP->MyParentCharacterBP->MyGrandaddy.h. I added a reliable NetMulticast RPC and a BlueprintImplementableEvent to MyGrandaddy.h.
  • I also added a new object type to the collision settings that just happened to share the name of a replicated variable on my character BP. I was losing my mind by the time I thought this could be the culprit.
  • I also added some ForceNetUpdates to PlayerStates and Controllers in MyGameMode.h.
  • Had server handle whether or not a player could move.
  • Added more configurable variables to the MyGameMode.h and had MyGameModeBP access them.

Well this is back and it looks like I’m screwed as I can’t get it to go away.

This is now happening with another blueprint that was derived from the same class as the previously broken blueprint.

This issue seems related: https://answers.unrealengine.com/questions/83960/character-bp-broken-after-upgraded-to-44.html

Hi Cobryis,

Please make an answerhub post at http://answers.unrealengine.com in the bug reports section so we can better assist you. Follow the guidelines for reporting a bug listed here: How do I report a bug? - UE4 AnswerHub

I don’t know how to properly repro it. Just at some point my blueprint breaks and becomes unfixable. I’ll post answerhub tonight with a video, but it may only show a symptom and not the problem.

In response to Adam on AnswerHub:

So this has happened to me 3 times in 3 slightly different manners (the first time was what I linked above).

I’ll try to describe in more detail what it’s like:
I’m working, and at some point I suddenly realize my character isn’t properly set up anymore. This only happens to my blueprint characters that are derived from another blueprint character.

The first time it happened there was no indication that in the editor it was broken. After several days of not playing the packaged game, when I finally did play it, the mesh was gone, and the rotation on the character (not camera) was broken. So I have no idea what led to that happening, but I posted my story in the link above.

The second time it occurred my issue was apparent in the editor (whereas before only the packaged game was showing up broken). I had been working with the parent class a bunch, and kept switching to the derived classes. I was just tweaking CharacterMovement variables. At some point I noticed the mesh was missing in one of my derived classes. The character mesh was None, and there’s no way to ‘reset’ to default. I fixed it by rebuilding the blueprint (so I right clicked on the parent BP and pressed “Create Blueprint based on This”). I copied the nodes over from the old blueprint and then replaced references (this is also broken though because it can’t seem to properly replace casts, so I had to manually replace those). The new blueprint worked (well, the same as the old, nothing was logically different).

The third time it occurred, yesterday, I was working with animations and sounds. I added an animation montage to the mesh my parent BP gives to its children, and then had only one of the child BPs use it. It was working fine, and then I moved onto sound. I then played a bit with the child BPs camera behavior (which I override from the parent BP) and after that I suddenly realized the child BP was missing his mesh. I reset the mesh, saved, and that worked in editor, but when I packaged the game he was missing. I tried reparenting the childBP and saving, but that didn’t fix it. So then I tried rebuilding the child blueprint (extremely annoying) just as I did with the second occurrence, and that did not fix it this time. I’m not even that certain editing the camera was the last thing I did. I just mentioned it because I was setting the Mesh to invisible for this particular character when they started, since they’re meant to be played from the first person perspective.

I think the issue has something to do with derived blueprints.

This seems related as well: https://forums.unrealengine.com/showthread.php?50158-2nd-Time-Blueprints-get-bugged-by-theirselfs

The part that is relevant is that I’m setting the mesh and it continues to be unset. The fact that it was unset to begin with also is part of the issue.

30 minute video of me walking through the issue from multiple different angles: http://youtu.be/0MPNjzCboMw

But here’s the TL;DW: if my PlayerControllerBP uses a cast-to one of my BP derived BPs, those BPs are then broken. This was working fine before. I can’t repro this in other projects. And switching to the experimental BP menuing system doesn’t fix the issue either.

Hi Cobryis,

From your video it looks like you are primarily working in C++. Are you doing any blueprint work or is your character built entirely in C++?

My character is pretty basic. I have C++ code for networked stuff and mostly exposing things to blueprint. Pretty much all client side things for my character are in Blueprint. My PlayerController is 90% blueprint, even containing a lot of the server logic. It’s C++ stuff is mostly just server stuff that the GameMode needs, which is almost entirely in C++.



#include "PropHuntCharacter.generated.h"

UCLASS()
class THIRDPERSONBP_API APropHuntCharacter : public ACharacter
{
	GENERATED_UCLASS_BODY()

	UFUNCTION(NetMulticast, Reliable)
	void OnPlayerStateUpdated();

	UFUNCTION(BlueprintImplementableEvent, Category = "PropHunt", meta=(FriendlyName = "OnPlayerStateUpdated"))
	void ReceiveOnPlayerStateUpdated(class APropHuntPlayerState* UpdatedState);

	UFUNCTION(BlueprintCallable, Category = "PropHunt")
	void SetCanCharacterStepUpOn(ECanBeCharacterBase Mode);

	virtual void Jump() override;
};




#include "PropHuntPlayerController.generated.h"

/**
 * 
 */
UCLASS()
class THIRDPERSONBP_API APropHuntPlayerController : public APlayerController
{
	GENERATED_UCLASS_BODY()

public:
	UFUNCTION(BlueprintCallable, Category = "PropHunt")
	bool IsSeeker() const;

	UFUNCTION(BlueprintCallable, Category = "PropHunt")
	bool IsHider() const;

	UFUNCTION(BlueprintCallable, Category = "PropHunt")
	bool IsTagged() const;

	UFUNCTION(BlueprintCallable, Category = "PropHunt")
	class APropHuntPlayerState* GetPlayerState() const;

	UFUNCTION(BlueprintCallable, Category = "PropHunt")
	class APropHuntCharacter* GetPropHuntCharacter() const;

	/**
	 * Called on the LocalPlayer for showing tag on HUD
	 */
	UFUNCTION(BlueprintImplementableEvent, Category = "PropHunt")
	void OnBroadcastTag(const APropHuntPlayerState* Perpetrator, const APropHuntPlayerState* Victim);

	/**
	 * Called on the LocalPlayer for showing save on HUD
	 */
	UFUNCTION(BlueprintImplementableEvent, Category = "PropHunt")
	void OnBroadcastSave(const APropHuntPlayerState* Savior, const APropHuntPlayerState* Saved);

	UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category = "PropHunt")
	void FinalizeTag(APropHuntPlayerController* const Victim);

	// Begin AController interface
	virtual void SetPawn(APawn* InPawn) override;
	// End AController interface

	UFUNCTION(BlueprintImplementableEvent, Category = "PropHunt")
	void OnSetCharacter(class APropHuntCharacter* InCharacter);

	void SetIsTagged(bool Tagged);

	void ResetRoundInfo();

	UFUNCTION(BlueprintImplementableEvent, BlueprintAuthorityOnly, Category = "PropHunt", meta=(FriendlyName = "ResetRoundStats"))
	void BP_ResetRoundStats();

	UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category = "PropHunt")
	void PlayerStateUpdated();
};


Hi Cobryis,

Does this happen in a clean project with no additional content or is it limited to this blueprint?

As I stated in the video and in previous posts, this just happens. I can’t repro it. The classes I showed you were working fine before, and then they weren’t. In the video I do try to repro it in a clean project, but I can’t (and I didn’t expect to). So just to be extremely clear: I had ChildBP derived from CharacterBP, and then ControllerBP had a “Cast To ChildBP” node and all this was working perfectly fine. Then, out of the blue, it was not working fine. When I removed the “Cast to ChildBP” and reloaded the editor, my ChildBP was fixed. However, when I re-add the Cast To ChildBP, it breaks again. I know my video’s long but I go over the issue in pretty good detail I think. I started by just showing the issue, then I start trying to fix it till I find removing the cast fixes it. I also tried flipping the experimental blueprint menuing switch just as I did originally, but apparently that’s unrelated.

I’d be willing to send you guys my project in a state that was broken. I don’t have time to try and figure out this issue myself, so I’m working around it.

Hi Cobryis,

If you could send the project I’d be happy to have a look. Unfortunately I haven’t been able to get this to occur on my end so having a look at the source may be the best option.

Yeah, though I’m wondering if maybe I should send you the repository so you can see the two different instances of this issue by checking out different changelists. Is that something you’d be interested in? Because the first case is slightly different than this third case (idk if I have a commit with the second occurrence). I’d just tell you the change numbers and you’d check them out in a detached state (I’m using git). You’d also be able to see the state of the project before the problem occurred.

I seriously think Blueprints system needs a big stability improvement.

I think it would be easiest to just send me the most recent version. More than likely they are caused by the same root error. If I am able to reproduce this we can attempt to find out what specifically is causing this error.

It’s cycling reference issue, Epic know about it but they are waiting with fix. I’ve posted a lot of AH issues about it and all of them was “will be fixed someday, resolved for now”. For my opinion everyone will run into this issue if doing more complicated game where you just need cycle references.

As far I can know Epic is targeting to fix that in 4.6 but I’m not sure if it can be done because it’s core of linker blueprints.

Agree. Please Epic do one release with fixes only. The issue is random - in one project it came after one week in another after a month and in another it’s working correctly. The best way to report this is to use UMG (insert earlier created widgets to vertical box -> have a events and references from one to another, commit couple of times and when you open the editor again you will see REINST before the references - everything will be broken)

Okay, what’s the best way to send it? I’ll try to do send it later tonight.

Update

They were able to reproduce the bug, and in my case it was due to a circular dependency:

Hi Cobryis,

Upon further analysis, we found a circular dependency in your blueprints, which is causing this specific issue:

…]

We are currently working on a fix for circular dependencies in blueprints. In the mean time breaking this circle should remove the error you are experiencing.