Tween in Function (should be solved, does not work for me)

There is an related (solved) topic (Tween in a function) but it does unfortunatelly not work in my project (GDevelop 5.0.127). @Gruk suggested to open a new topic.

I’m trying to have a function (with an obj-param) which starts a tween for said object.
Important: My object DOES have a tween behavior assigned.

My function:

My function config:

My Events:

Here is the thing in action.

  • The image at the bottom/left should be tweened (it has the tween behavior)
  • You can see that my event is executed because the little frame at the wall rotates 25°



As I explained, myObj does not have the tween behavior. Click on the blue button and add it.

Thank you for your answer. I thought it’s enough to add the tween to the object in the scene. I’ve added it now also in the function but it still does not work.

Try double-clicking on the tween action inside the function editor, and confirming.

I did but it still does not work. I’ve also tried to remove the tween-behavior from the object in the scene (I thought maybe two tweens behaviors may conflict eachother) and I also deleted the whole action and re-created it just to be sure. But nothing of that helped :,(

I even tried to do the create-thing from the other thread and yes, there is a new instance of the object but it does not tween.


I also tried to check the profiler/debugger but there does not seem to be an information if an object has a behavior or not.

When you write a function, it can be applied to several objects, scenes, and even projects.
Before you use a tween action in a function, you need to add the behavior to the function object.
Once you’ve done that, add the tween action and you won’t see this missing behavior warning:

Then, inside any scene you want the function to work, add the tween behavior to any target object before adding the function action.

Thank you, now it works. So, the order of events is very very important. It’s like

  1. Create Function
  2. Add Tween behavior within function
  3. Add Tween behavior to object in the scene

In my case I did step 3. first and then 1. and 2. and maybe that broke it? Very weird. I’ll keep an eye on it and when I can verify my theory I’ll update this thread.

Thanks a lot for your help!