Closed gamedevserj closed 8 months ago
Hey @gamedevserj, I'm very glad you like the library :)
All your raised points are correct! I guess I wasn't familiar with this way of pausing a game (using GetTree().Paused = true
).
Do you think that something like this would fix the issue and any other edge case?
public partial class GodotGTweensContextNode : Node
{
public override void _Ready()
{
ProcessMode = ProcessModeEnum.Always;
}
public override void _Process(double delta)
{
GodotGTweensContext.Instance.UnpausableContext.Tick((float)delta);
if (!GetTree().Paused)
{
GodotGTweensContext.Instance.PausableContext.Tick((float)delta);
}
}
}
Then as you said you would be able to select which context to use when playing, with something like:
void Play(bool pausable)
As you said, for installation simplicity, I would prefer not to add extra steps to it.
Hey @Guillemsc thanks for the quick reply! Yeah, it looks like it should fix it, and hopefully any other issues that are not apparent now :)
I also think void Play(bool pausable = true)
should probably be by default
Cool, sounds good then, I'll work on the feature and release a new version as soon as I can. Thanks for raising this 👍
@gamedevserj would It also make sense to, instead of having void Play(bool pausable = true)
, have Play
and PlayUnpausable
?
This way I don't have to add as many parameters to all Play variant methods. I think it would lead to a cleaner API.
@Guillemsc honestly, I don't know.
When I was using Unity there is an asset called DOTween where they use .SetUpdate
with enum type where it can be set as independent of TimeScale.
I think having two separate methods is fine in this case.
Yeah, but in this case Unity and Godot work differently in the sense that, _Process is not even called when it's paused, where in Unity pausing is done by setting TimeScale to 0 (and having scaled and unscaled TimeScale), which makes things easier. I'll go with two separate methods for now then, thanks.
A new version has been released with this implemented (nuget and asset library still on review). If you encounter any issue or have any other suggestion, don't hesitate on opening a new issue 😀.
@Guillemsc awesome, thanks a lot!
First of all I wanted to thank you for the creation of this library, it is awesome!
Currently the extension relies on
_Process
method that is called by GodotGTweensContextNode.cs to update tweens. Leaving the script as is would mean that when pausing the game no tween would be updated. Which means that using it for fading menus in/out is not possible, unless we add_Ready
method where we setProcessMode = ProcessModeEnum.Always;
However doing so would mean that any tween that controls game objects (moving platforms etc.) would also be executed even if the game is paused. My suggestion is to have two nodes (and I'm guessing two contexts) that have different process modes and add an option for tween to set whether it should be updated when the game is paused or not.Although I guess it goes against the issue https://github.com/Guillemsc/GTweensGodot/issues/5, because it would not help simplify installation.