Component Activation functionality

So I’ve been trying to use the set Active, toggle Active and Deactivate nodes under the components menu and i cant see to get ANY results from it.

At first i thought it was to make an object active meaning player input will register on this Actor when the Exec was called, this was not the case.

I then tried to hook up a light to the deactivate node to see if was more of a turn " on, off" deal but alas no results.

has anyone been able to get any sort of result from this set of nodes, are they broken at this moment? is my understanding of the nodes wrong?

Basically I’m attempting to make certain actors not receive player input until they become visible and have been set to ‘Active’ (which i currently have a work around for this using the set collision enabled node) just wonder what this group of nodes is. :?

Documentation… Activation | Unreal Engine Documentation

Hello Tone,

I have set up a simple example of how to use the Activate node. What I wanted to do was have my character be unable to move until 2 seconds after the level begins. You can see how I achieved this in the screenshot below. First, I had to go into the Character Movement component, and set the Auto Activate checkbox to false, which is located at the very bottom of the details panel. After I did this, I set up the following blueprint. My result was that my character was unable to move for 2 seconds until the Activate node fired, which then allowed me to move freely.

In terms of your attempt to hook up a light to see if you can turn it on or off, this would be better accomplished by using a Toggle Visibility node on your light. Please let me know if there are further questions.

Does the activate/deactivate nodes work with skeletal mesh’s? I’ve set up a number of simple set ups and the activate-deactivate nodes don’t appear to have any effect on skeletal mesh.

Hi @Sean L. I’d appreciate your help on a similar question: Interp to Movement Activation from Level Blueprint - Blueprint - Epic Developer Community Forums.
Thanks!

I know exactly what you are trying to do, as I’m trying to achieve the same result, myself. I’ve got a scene component which has an assortment of functions which I don’t want to execute, even though they are being called at certain points, unless the component is activate. Auto activate is also set to false.

The only usefulness of activating, I can discern, is to use it as an additional bool check when running each function/event. Here is what that looks like:

I know this thread is very old, but it’s one of the first results on google when trying to look up what the concept of “Activation” in a component means, so I wanted to provide some of my findings here.

In short, I think Activation/Deactivation doesn’t do anything by itself. If you want Activating/Deactivating a component to run some logic, you NEED to bind to the OnComponentActivated and OnComponentDeactivated event dispatchers.

Here’s a tangible example of how I’m utilizing component activation in my project:

I have an actor component called AC_TimerController. It is used to control the main timer in my game, and create/update the widget used to display the amount of time left.

The original way I had it set up was that anytime my game needed a timer, my GameState would run the AddComponentByClass node to create a new instance of AC_TimerController inside of GameState. AC_TimerController’s BeginPlay would automatically create the timer widget, and the Event Tick would update it.

If my game no longer needed a timer, I’d destroy the AC_TimerController component inside of GameState. AC_TimerController’s EndPlay would automatically destroy the widget it had previously created.

This worked fine, but it felt weird to constantly create/destroy AC_TimerController, especially since I knew I’d only ever want one timer on the screen at a time. Activating/Deactivating the component felt exactly like a concept I wanted to apply here, and after digging around and doing my own experiments, this is how my timer system looks now:

AC_TimerController is already inside of my GameState by default. AC_TimerController’s “Start with Tick Enabled” is set to false, and in its BeginPlay, I bind functions to both OnComponentActivated and OnComponentDeactivated, as shown here:

OnActivate does a few boilerplate things to get the timer controller ready, as well as creates the timer widget itself, but importantly, it enables the component’s tick:

OnDeactivate does basically the opposite of the things above; it removes the created widget and sets the component’s tick enabled to false.

Now, whenever I want my game to start a timer, I can simply Activate the AC_TimerController inside of my GameState:

image

Activating it will call its OnActivate function, which does all the boilerplate stuff I showed in a previous screenshot. When I’m finished with the timer I can then run the Deactivate node in order to run all of my OnDeactivate logic.

While this feels much better than creating/destroying AC_TimerController whenever I wanted a timer, I can’t shake the feeling that it’s somewhat overengineer-y. In the above StartMainGame event, I could have easily just called AC_TimerController’s OnActivate function to achieve the same results.

However, I know there’s a number of other functionalities I can use with regards to Activation listed in the docs here, which maybe I’ll find useful later down the line. The above setup also allows me to make other actors bind functions to AC_TimerController’s OnComponentActivate dispatcher, so I could for example make a streetlight turn green when AC_TimerController is activated, or something.

Anyway, I’m not sure if I’m applying the concept of Activation the way the UE devs intended, but what I listed above works for me. I hope this info helps anyone in their search-engine treks learn a bit more about what Activate does to an actor/scene component :slight_smile:

3 Likes