It seems after loading our asset pack blueprints in editor version 4.11.0-2810555, the child actor component actor instances do not have their construct scripts called.
Our blueprints for traffic light construction rely on their construction scripts to replace their default static meshes, and to create the dynamic material instances for their signal illumination effects for the lenses. All the subclass blueprints call their parent construct scripts.
If I place an instance of one of the subclass traffic light blueprints, the resulting actor appears and functions as expected. However, the traffic lights as children of a frame blueprint do not appear as expected since they never have a chance to change their meshes or to create their dynamic material instances.
Our blueprints have worked since their creation in 4.7. Please let me know if this will be fixed in the engine without the need for a workaround. It is expected that all instances should have construct called regardless of nesting.
Thanks in advance.
Does your construction script have the following in it:
Unfortunately, I have not been able to reproduce this on my end. To test, I did the following, please let me know if I need to add additional steps or if there is anything else I could try to reproduce this on my end:
- Open Editor (any project)
- Create actor blueprint
- add a point light
- In construction script, create “set light color” node, set target to point light, break struct pin, set each float value to "Random Float in Range (min 0, max 1).
- Create new actor blueprint
- Create Child Actor component, set type to previously created blueprint
- place a copy of the second blueprint into the level
At this point, the light color changes each time the construction script is called as I expected. Is there something I am missing?
It seems going through those steps you listed, I have the same issue in game mode. As you recommended, I created an Actor-based blueprint with a simple light component. Then made another Actor-based blueprint with a child actor component referencing the previous blueprint. In the blueprint with the light, the construct script sets a random color to the light.
To be clear, the problem occurs at runtime. In editor mode, things look as expected. It is when I try game mode, the construct scripts are not called for child actor component blueprints. With the test example, the light has random colors assigned when it is moved in edit mode. However, during play it is full default white every time.
The blueprints we have in the assets pack have been running properly since 4.7 without any changes. And yes, the subclass construct scripts call their appropriate parent construct script as stated before.
I suppose I will have to install 4.11 on another computer to see if the results are the same, for a sanity check. Are you running a slightly newer version of the editor than 4.11.0-2810555?
Thanks for looking into this.
Unfortunately we need the static mesh and dynamic material to be set in the construct script so that the assets look proper during edit time; so that WYSIWYG without having to constantly start and stop the game environment to determine the final appearance. It seems that construct should be inherent to object construction regardless of editor or game execution.
It worked properly in engine versions prior to 4.11. The assets produced no warnings or errors either. Installing 4.11 to another computer produced the same issue, so there is no environmental factor as expected.
The traffic lights asset pack has the assets to which I am referring. Placing a 5-bulb traffic light instance works as expected, but it is not a child. When a traffic light frame is placed, all the traffic light meshes default to the base traffic light model (3-bulb vertical) and their dynamic materials have null references. Traffic lights can be nested 1 to 2 levels by either a single frame actor or intersection arrangement actor, respectively.
I am very curious if you will see the same issue. Thanks again for checking into this.
That is the same version I am on. Unfortunately even spawning at runtime seems to work correctly on my end. Do you have a sample asset or project I can look at?
Is it possible to move the functionality you are using to “event begin play” instead of construction? The Construction Script is intended for in editor use as opposed to at runtime. Event begin play will run immediately after an actor is spawned.
Does this occur with any other actors or is it limited to the traffic lights pack?
It seems that the issue happens with the light example as before. So this issue is not only within the context of the asset pack. This time in the test I made another clear project and set a solid blue color for the light in the construct script.
- Created Test blueprint extending Actor
- Added Point Light component
- Added nodes to construct script to set the light’s color to blue
- Created TestComplex blueprint
- Added a ChildActor component
- Set the ChildActor class type to Test blueprint
- Dropped an instance of TestComplex in the world
- Child light appears blue in edit mode
- Pressed the Play button for game mode
- Child light appears white
In the meantime I will download the latest update of 4.11 to see if the issue still exists.
I have been able to reproduce this on my end and have entered a bug report, UE-25451, to be assessed by the development staff.