Every time I restart the editor, any Blueprint getter for a Blueprinted variable that is a reference to other blueprint actors disconnects its pin from its function calls (this is happening without compiling) as seen here:
The red ‘ERROR!’ states the following - “Error This blueprint (self) is not a BP_FadeSceneActor_C, therfore ’ self ’ must have a connection.”
Note that this compiles and runs in the Editor without issue when connecting the pin, it is only when restarting the Editor that it disconnects the pin and gives this error (the error shown is only stating that it cannot have a ‘Target’ of self within the blueprint it is being processed/called from).
Before restarting the Editor, you can see the pin can connect and compile without any issues here:
If I store a variable in C++ I can get the variable and call its functions without the pin disconnecting but if I create the variable in Blueprints it doesn’t work. I have tried setting the Blueprint variables to ‘Editable’ and ‘Expose on Spawn’ but that didn’t make any difference.
I have tried creating variables for multiple different blueprint actors and calling their functions (both C+±made functions and blueprint-made functions, neither works) with the same results.
A work-around (but not a solution - this is still a bug) I found was to set the Blueprint variable to be an ALevelSequenceActor reference instead (the parent class of my FadeSceneActor Blueprint class) and then cast the actor to its actual class to call the function; this stopped it from disconnecting the pin on Editor restart:
NOTE: This is happening in a Blueprint deriving from GameInstance, not sure if this makes a difference or if it happens in any class but have not got time to test all cases this error occurs at the moment as my main concern is it not working in this current use-case.
To replicate my scenario:
- Create a C++ class that derives from the ‘GameInstance’ class.
- Create a Blueprint class that derives from the C++ class we created in step 1 then set it as the ‘Game Instance Class’ under project settings (I will call this class ‘BP_ApplicationInstance’ in the following steps).
- Create a Blueprint class that derives from ‘ALevelSequenceActor’ and create a function for it (I will call this class ‘BP_FadeSceneActor’ in the following steps).
- Create a variable in ‘BP_ApplicationInstance’ with a type of ‘BP_FadeSceneActor Reference’.
- In any other Blueprint class, call ‘Get Game Instance’, cast it to ‘BP_ApplicationInstance’ (the class we created in step 2), get the variable reference to ‘BP_FadeSceneActor’ and call the function you created for it.
- Make sure everything is saved then close the UE4 Editor and re-open the project.
- Find the pin disconnected just like in the following image:
There seems to be a red line with the text “ERROR”. Can you share what this error is?
Cheers for switching to comment from answer. I have edited the Bug Report to include what the ‘ERROR’ text is and to show that it connects fine before restarting Editor each time. The error is simply saying the ‘Target’ cannot be self (as there is no pin connected for ‘Target’ after reloading the Editor).
I attempted to reproduce this in 4.14.3 using the steps you provided but the pin doesn’t disconnect for me on project open. Does this reproduce in a new blank project for you?
If so, would you be willing to upload a small test project that has the issue?
I spent a few hours trying to reproduce this in a new project but had no luck. I even tried migrating over the Blueprints and C++ classes involved but it didn’t make a difference; meanwhile, I’ve re-created all of the Blueprints in my actual project but it still occurs.
I started with version 4.14 for this project so nothing was created in an earlier version but possibly something went wrong between 4.14 and 4.14.3 and had an effect.
I’ll try creating a new project and migrating everything in my current project over to see if that solves the issue.
I’m resolving this issue for tracking purposes. When you have more info, just post back here to reopen the report.
It turned out to be the use of ‘FObjectFinder’, via C++ to get a reference to the Blueprint classes for spawning later at runtime, that caused the pin disconnection on restart. I had forgotten they were being created in C++ via this method which is why my re-production method did not include it.
I have since changed from using ‘FObjectFinder’ with path references, where I now store member references to Blueprint classes in a Blueprint class instead. This worked out nicely since I had already intended to eventually do this for a simpler and more reliable means of storing references to Blueprints (instead of having error-prone paths manually entered into a datatable).
I still spawn the Blueprint actors via C++ but not using ‘FObjectFinder’ anymore has stopped the issue of them disconnecting on Editor restart.
While I have a better approach that now avoids this issue, it is still an issue that I don’t believe UE4 should be causing to happen (especially seeing as re-connecting the pins allowed me to re-compile and run the game fine, meaning it appears that there was no intentional cause for them to be disconnected on Editor restart).
I will update my re-production steps tonight or tomorrow when I have time to grab down the old build from our repository and test it in a new project (so as to not waste any more of your time).
same here. after editor crashed i have to rewire all ~200 connections every editor launch. need fix
Sorry I meant to write the re-production steps earlier but I got caught up with other work and forgot:
See my latest reply below for what I found was causing it; I’ll try and get a re-production of it up to show what is going on (in case you can’t follow what I have said in my reply below) so that you can figure out a work-around while this is broken.