Why can't a timeline be placed in a function?

I want to build a function that causes a sliding door to open. The way I was taught to animate this is with a timeline. I want to make this a function so that I can call it for a variety of different triggers (player use, player proximity, projectile collision, etc) and as a simple exercise to familiarize myself with the blueprint interface. However, I can’t directly place a timeline into a function and I can’t compress code into a function that includes a timeline. Am I missing something logical that points to why functions and timelines can’t coexist?

Hey Mattinator,

Check out our Door Tutorial on the Wiki as it will delve into Timeline setup in section 2.6.

This is an excellent tutorial as it teaches you how to set up different situations for the door (i.e. Proximity vs. Player Input - which sounds like something you are looking to do).

Let us know if you have any issues,

Happy Blueprinting! :slight_smile:

-W

Any idea as to why the timeline can’t be used in a function? I understand that I can circumvent this particular problem, but it would be helpful to me to understand what the rules are governing what can and can’t be present in a function.

edit: It looks like a custom event fills the role I’m looking for. Thanks for your help.

Timelines are time dependent, but functions trigger once, instantly. You want to use a Collapsed Graph for anything that happens over time.

Thank you,

Thanks! Just what I was looking for.

I was wondering the exact same thing as OP. I wanted to move my Timeline to a function (with a bunch of other nodes, not JUST the timeline…) for re-usability reasons. So I tried Collapsed Graph as you mentioned… but it turns out you can’t really call a Collapsed graph more than once (as opposed to functions). Which basically brings me back to square one again…

In the end I had to create a custom event in my blueprint, and call that event inside itself… which kinda feels like a hack.
I still don’t get why you can’t have Timelines in a function…

1 Like