Use Tween on Objects

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By timoschwarzer
:warning: Old Version Published before Godot 3 was released.

Hi there!

I have made a class in GDScript, which extends “Object”, so I can’t add it to the scene tree. (This is intended)
The problem is, that Tweens don’t work here. _process and _fixed_process are not available, too.
Is there any other possibility to get any kind of processing or interpolation withing non-node objects?

Thanks in advance!

Only Tween needs to be in the tree and it can work on any Object, if nothing has access to the tree then you wont be able to do anything.

Can you expand a bit on the scene structure and where is this Object?

eons | 2017-05-25 15:40

:bust_in_silhouette: Reply From: Zylann

When you write bare objects, you get what you asked: bare objects.
So if you want frame by frame processing, you have to call functions yourself from a node in the scene.
Tweens are nodes, so they have to live in the scene to work. However they can tween anything you want, nodes, or bare objects, or something they don’t know as long as that thing has a value going from A to B (using getters and setters).