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"

Construction Script for Actor Components

Hi,

Is it possible to have a construction script for Actor components? I am currently using the Actor Component to add additional functionality to existing actors, such as physics impact sounds, footstep sounds, flickering lights etc.

It is possible to use the BeginPay event to do some initial setup, however this could be costly when starting the game if the component is doing a lot of computation, or you have a bunch of actors using the Actor Component.

Example

flickering component that has to initially loop through components in the parent actor and create an array of light components, and create dynamic emissive material instances to be modified on the Tick event in response to a linear color curve.

This has to be done in BeginPlay, because there is no construction script for Actor Component (that I can find): https://www.youtube.com/watch?v=1G72Jp2IR7o&feature=youtu.be&t=95


Could I request this as a feature if it isn't possible already?

Thanks

Product Version: UE 4.10
Tags:
more ▼

asked Feb 28 '16 at 01:45 PM in Blueprint Scripting

avatar image

Alan Edwardes
36 2 5 10

avatar image BrUnO XaVIeR Jul 29 '16 at 07:44 PM

If you are creating your own custom Component, you can do this from within the function UActorComponent::PostInitProperties()

From there you call a BlueprintImplementableEvent that could act just like a Construction Script to initialize blueprint graph stuff.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

At the moment, no. But what you can do is make your component an actor instead and attach that as additional functionality to existing actors. It works but with that said, I'd prefer a construction script within the actor components.

more ▼

answered Jul 03 '16 at 11:51 AM

avatar image

MJ_01
822 38 39 240

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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