# Is there a way to conditionally enable or disable sections in a sequence at runtime?

**URL:** <https://forums.unrealengine.com/t/is-there-a-way-to-conditionally-enable-or-disable-sections-in-a-sequence-at-runtime/1324233>\
**Category:** Cinematics & Media\
**Tags:** unreal-engine, question\
**Created:** [October 6, 2023, 1:18pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-conditionally-enable-or-disable-sections-in-a-sequence-at-runtime/1324233 "2023-10-06T13:18:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![animal14](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@animal14](https://forums.unrealengine.com/u/animal14)\
**Post date:** [October 6, 2023, 1:18pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-conditionally-enable-or-disable-sections-in-a-sequence-at-runtime/1324233/1 "2023-10-06T13:18:56Z")

</div>

Here is the code that disables the section when certain conditions are met.  
The code worked correctly in the editor.

void UMyMovieSceneSubSection::Setup(FPersistentEvaluationData& PersistentData, IMovieScenePlayer& Player)  
{  
bool bMatch = (Result == GetResult());  
if (bMatch == IsActive())  
{  
return;  
}

```
SetIsActive(bMatch);

```

}

However, it did not work correctly in the package. I realized that the Modify function behaves differently because of the WITH\_EDITOR define.  
I explicitly called the MarkAsChanged function, but it also did not work.

Is there a way to conditionally enable or disable sections in a sequence at runtime?

I referred to the link below, but it still didn’t work for the same reason.

[https://forums.unrealengine.com/t/sequencer-mute-tracks-at-runtime-from-c/476278/4](https://forums.unrealengine.com/t/sequencer-mute-tracks-at-runtime-from-c/476278/4)

The link below mentions that subsequences are easier to enable and disable, so they are generally used as a solution instead. What is this method?

[https://forums.unrealengine.com/t/faq-sequencer/493455](https://forums.unrealengine.com/t/faq-sequencer/493455)

Is there a way to conditionally enable or disable subsequences in a sequence at runtime?

---

<div class="post-metadata">

**Author:** ![Max.Chen](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/max.chen/32/1194502_2.png) [@Max.Chen](https://forums.unrealengine.com/u/Max.Chen)\
**Post date:** [October 6, 2023, 4:17pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-conditionally-enable-or-disable-sections-in-a-sequence-at-runtime/1324233/2 "2023-10-06T16:17:03Z")

</div>

You’ll need to toggle Volatile on the level sequence. Try this bit:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/5/6/c56b1b3261f68e1879aa9c5398a95d712e67600f.png)

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [November 5, 2023, 4:17pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-conditionally-enable-or-disable-sections-in-a-sequence-at-runtime/1324233/3 "2023-11-05T16:17:05Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
