x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Add ActorComponent node not using Expose on Spawn Settings

When dynamically adding an ActorComponent node from BeginPlay, the Add ActorComponent node does not use the Expose on Spawn settings from the Add node. This is happening on 4.14 and 4.15

Steps to reproduce from empty project:

  1. Create a blueprint from ActorComponent called BP_ActorComponent. In BP_ActorComponent, create a variable called StringVar, set it to Expose on Spawn and Editable, and make the default "Default".

  2. From BP_ActorComponent's Event BeginPlay, drag a pin and create a Print String node. Set the StringVar variable as the string input.

  3. Create a blueprint with StaticMeshActor as the parent. From the Blueprints BeginPlay event, create a "Add BP_ActorComponent" node. In the node, change the variable StringVar to "Not the default"

  4. On Play, "Default" will print to the screen instead of "Not the default"

Product Version: UE 4.15
Tags:
more ▼

asked Mar 07 '17 at 03:20 AM in Bug Reports

avatar image

dingtech
26 1 3 7

avatar image dingtech Mar 07 '17 at 03:24 AM

Example project attached

bugexample.zip (438.9 kB)
(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

Hello dingtech,

After looking through you project and it appears to be working as intended. Components are initialized before actor's begin play. I have provided a link to documentation that includes a flow graph. I hope that this information helps.

Link: https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/Actors/ActorLifecycle/

Make it a great day

more ▼

answered Mar 07 '17 at 04:04 PM

avatar image

Rudy Q ♦♦ STAFF
47.7k 545 132 522

avatar image dingtech Mar 07 '17 at 10:15 PM

Im not sure that addresses the issue? In this example, the Actor's BeginPlay is adding an ActorComponent, and when the ActorComponent's BeginPlay is then called, it is not using the Expose on Spawn variable that is being passed to it from the Actor's BeginPlay node.

(comments are locked)
10|2000 characters needed characters left

Messing around with your project I managed to get it to work by placing a delay node before the Print String node. It seems as if the variable is set at the same time the sphere BP adds the component and somehow the Print String node doesn't get it in time. Might be a bug.

more ▼

answered Mar 07 '17 at 11:30 PM

avatar image

Althaen
161 13 17 29

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question