Download

Compiling one Blueprint uncompiles another

My MyCharacter BP Casts to my MapGenerator BP and calls the Generate Map Function. When I compile MapGenerator the MyCharacter BP also wants to be compiled.

Is this ok or is there something going on here? I can only imagine this getting worse as my network of BP’s becomes ever more complex.

Is there a compile all blueprints option somewhere?

This happens when you’re using Blueprint communication, where one Blueprint is directly accessing variables and such that belong to another Blueprint. It’s expected, and shouldn’t be anything to worry about if you’re just compiling after making changes. I’m not sure there’s a compile-all option, but when you test the game all Blueprints will be compiled before it starts.

It does start to feel a little messy when you’ve got a big network of Blueprints that all talk to each other needing to constantly be saved, and hopefully it’s something that will be improved in future. In the meantime, Blueprint Interfaces might be a “cleaner” alternative for really common interactions between Blueprints that you’ll be using a lot, such as certain player interactions or handling a melee attack hitting an enemy.

A quick way to build them all would be to quickly start and end play and then click the save all button above the content browser. Other than that I agree with the rest of what Thomas says, once you understand interfaces they’re really handy!

I am writing a blueprint fundamentals on wiki that talked about this.(haven’t done writing yet.)
So the short answer is the CastTo node you use in blueprint that access another blueprint’s variables or functions(like Thomas said, always listen to Epic guys.)

A short term solution would be don’t call those function directly from with in MyCharacter.
The proper hierarchy for your event would be:

  1. your PlayerController class emits a generate map request to GameMode(remember Pawn can be destroyed.)
  2. put your MapGenerator BP as part of GameMode, if you put some persistent object into your map, still let GameMode has it’s reference with BeginPlay event.
  3. remove the cast from your MyCharacter entirely.

This way, PlayerController only has to call GameMode events, and GameMode will be the only one use your MapGenerator BP’s functions.
The dependency would be MapGenerator->GameMode->PlayerController, so it’s linear and not circular.

Thanks for the reply! Compiling on play sounds like a good enough work around for the time being.

I have been working on Interfaces lately and while I still have much to learn they do seem to help quite a bit. Using an interface already helped me clean up a similar problem that was actually broken. I will keep working on them and put them wherever I can.

That sounds reasonable. Do you put your inputs in playercontroller as well? I have all that in MyCharacter, but I can move it over to the controller easily enough.

My MapGenerator is already spawned by my GameMode. Is this what you mean, or are you talking about making it a child? I am also thinking about having multiple map generators or multiple game modes to represent the many fundamentally different types of maps that can be generated.

Nope, PlayerController are suppose to communicate with GameMode, and maybe do some weird stuff, most of the time “input” can just be with Pawn if it’s movement control related.

Yeah, spawn by GameMode is good, just keep it in GameMode’s variable.