Build version:
4.6.1-2386410
Description:
Apparently when you take an object that was cast to an interface and check if it is valid with the “isValid” node, the shipping build of the project will crash. This crash won’t happen when running the project in editor or in a development build.
Repro steps:
- Create blank project (No code, no starter content)
- Create new blueprint “MyBlueprint” that subclasses Actor
- Add a scene component as the root of MyBlueprint
- Add a static mesh component to MyBlueprint
- Use the “Sphere” static mesh in the engine content for the static mesh component
- Create new blueprint interface “MyInterface”
- Create new function “GetStaticMesh” with output “staticMesh” of type “StaticMeshComponent” in MyInterface
- Implement MyInterface on MyBlueprint
- In the “GetStaticMesh” function in MyBlueprint, connect “StaticMesh1” to the return node
- Create a new “Default” level
- Save the level as “MyMap”
- Place an instance of MyBlueprint on (1500,0,20)
- In the level blueprint of MyMap create the following graph:
- In the project setting set MyMap as the Game default map
- Play the level and verify that when pressing “U” the ball will move up and go back down after releasing “U”
- Make a shipping (not development) build of the project (build lighting, cook content, package project)
- Run the final product and attempt pressing “U”. The game will crash:
- Go back to the level blueprint of MyMap on the engine and make the following change:
- Make a second shipping build with this new change
- Verify that with this new build you can press “U” to make the ball move up and down without crashing
Notes:
-
The problem is inside the “isValid” function and since the “isValid” macro uses the “isValid” function then they both cause the same behavior
-
The “!=” node also crashes just like the “isValid” function:
-
The input pin on the “!=” and “isValid” nodes are of type object while the output of the “Cast To MyInterface” node is a “MyInterface” instance object. But conceptually this is not a problem since all interface instances are, by definition, objects. This is the reason why playing in engine doesn’t crash and why we are not required to use a “To Object” node in the blueprint.
-
Making a “Development” build (as opposed to “Shipping” build) will not cause any crash whether using “!=” or “isValid” without a “To Object” node.
-
Same issue goes with the “==” node followed by a “NOT” node
-
To summarize, this problem will happen when using an interface with “isValid” function, “isValid” macro, “!=” node, “==,NOT” nodes, and probably any other node that takes an object as input.