Compiler Error for Indirect Blueprint Component References

In UE 4.8.1, I’m experiencing a bizarre Blueprint compiler error. The following steps reproduce the issue:

  1. Create a new blueprint-based component called “MyComponent.” Give this component a single function called “MyFunction.”

  1. Create a new actor called “MyActor,” giving it a “MyComponent.” Call “MyComponent.MyFunction()” in the “BeginPlay” event.

  1. Create a new actor called “MyOtherActor,” and give it a variable that holds a reference to a “MyActor.” Again, call “MyActor.MyComponent.MyFunction()” in the “BeginPlay” event of this new actor.

  1. Change “MyComponent” in some way (I just added an extra boolean variable to it.

  2. Recompile “MyComponent.”

  3. Notice that there is a transient compiler error in “MyActor.” This is annoying, but not fatal. “MyActor” can be recompiled with one click.

  4. However, notice also that the pin from the referenced “MyComponent” to “MyFunction()” has been disconnected in “MyOtherActor.” This is fatal, as it will stop compilation for any and all blueprints which reference the component indirectly like this. It also causes hidden logic errors if the component was, say, passed as a function parameter instead. Such an error will not generate a compiler error, but will cripple the game’s logic.

This issue can be worked around by using something like the following:

In the long run, I feel that it would be better to throw compiler errors than to ever disconnect a pin automatically. Disconnecting pins is the equivalent of automatically rewriting lines of source code, and it’s not even remotely close to okay. I shudder to think of what other logic errors may have snuck into my game due to issues like this that I have failed to catch.

Hey Moonspine,

Thanks for reporting this to us. I followed your reproduction steps closely and I see that you’re provided with an error however I am not when I make a change to the ‘MyComponent’ blueprint. I added in a boolean and even attached it to the printstring from ‘My Function’ and no errors have appeared in either of the blueprints.

Have you been able to reproduce this each time you follow these steps? If so, would you mind zipping the blueprints and providing them to me so I can include them in a new project and compare ours and see what the difference may be?

I appreciate your time and look forward to hearing from you, thanks! :slight_smile:

I’l do you one better than that. I’ve attached a blank project with blueprints that can reproduce the problem in UE 4.8.1. To reproduce:

  1. Open the project

  2. Open MyActor and MyOtherActor (this is apparently an important step, and is likely why you couldn’t reproduce it. It doesn’t fail if the blueprints are not open in the editor.)

  3. Open MyComponent and add a new boolean variable (default name is fine).

  4. Compile MyComponent

  5. Look at MyActor and MyOtherActor to see the errors.

49729-blank.tar.gz (1.59 MB)

Hey Moonspine,

You’re probably correct. I may have closed out the blueprints when attempting this which did not cause the issue. I have however been able to reproduce this within your project that was provided and my own. I have submitted a report referenced as: UE-18430.

Thank you again for noticing this issue within the blueprint editor. If you have any further questions or concerns, please feel free to post a new question to AnswerHub!

Have a great weekend!

No problem! Thanks for being so responsive. Now that I’ve learned that it only happens if the blueprints themselves are open though, I at least have a workaround. I’ll just be careful until the fix is released.

No problem, feel free to reply back here if you notice that workaround isn’t working well for you until we can get that fix out for the public.

I appreciate your assistance with this matter, have a great day!

Hey , I just wanted to see if we are going to see a fix in 4.9 or we need to use the workaround there as well

Hey ,

UE-18430 was not ready for 4.9 however, it’s currently scheduled for 4.10 but it’s not resolved yet, so that could change at any time. Feel free to ask again in a few weeks.

Thank you! :slight_smile: