For this purpose I have created two tween set collections, ITweenSet and ITweenSequence which help to make this easier by providing a similiar API to ITweenHandle, but allows for managing multiple ITweenHandle instances at once. Since an ITweenHandle could represent either a single tween or batch of tweens, these collections do not distinguish between them and can handle them both equally well. For any issues or pull requests regarding performance improvements, at minimum please include details and screenshots describing the issue in as much detail as possible and if relevant showing a before and after profile.

However, where there are many tweens that stop at the same time there is a performance hit for cleaning them up. If starting many tweens on a single frame that have the same duration it may be advantageous to take advantage of the batch APIs on JTweenControl. These allow for the creation of many tweens at once whose data is stored in a linear fashion and when completed can be cleaned up much more efficiently. There are some differences to take into account when using these jetwen methods, particularly around events and ITweenHandles if used. However, there are many circumstances where user control over tweens is important, particularly where a user may want to pause, resume, or stop a running tween. This is possible by using the tween method overloads that offer an out ITweenHandle parameter.

In the scripts where you want to use JTWeen, make sure to import its namespace. Once imported, a new AssemblyDefinition JCMG.JTween will become available that contains the runtime JTween code. If the scripts that you need to be able to interact with JTween are in an AssemblyDefinition, they will need to add JCMG.JTween as a dependency.

Default values are provided to help simplify calling these methods, but for specific type of transformations (Local vs World) certain parameters like SpaceType must be provided to set the correct transformation behavior. The extension methods for tweens generally focus on a specific type of tween transformation to simplify the API and require less mandatory parameters. ITweenSet is an tween collection that allows a user to add X number of ITweenHandle instances and be able to seamlessly execute play, pause, stop, rewind, restart, or recycle actions on all of them at once. In addition, it offers the ability to add listeners for when the ITweenHandles are first played and when all of them have completed. More complex chaining or grouping of tweens can be tedious if attempting to do this manually by using either single or batched listeners for Started, Completed events.

This emphasizes a strategy of creating tweens only when needed, avoiding allocating instances of handles to tweens when none may be needed, and avoids requiring by default that users have to manage the lifecycle of a tween. These type of methods will offer System.Action callback parameters for when a tween starts and completes to be able to chain relevant functionality to tweens. Creating tweens can be done by either using the provided extension methods which offer a variety of specific ways of animating transforms or by making calls directly to JTweenControl.Instance which offers all of the tweening methods that are available with all parameters. The example below covers the same tween data, but shows how they vary when created through extension methods or JTweenControl directly. Many API methods exist both as extension methods and on JTweenControl for tweening individual transforms.

These methods will create tweens that do not play or clean themselves up automatically and require more hands-on managemenent from a user over its lifecycle. Once created, these tweens will remain in the JTween managed data until explicitly recycled. Once a user has recycled an ITweenHandle, they should clear any local references to it as it will be reused the next time a user attempts to get another one. Using JTween should be a straightforward experience if you’ve ever used similar tween libraries for Unity, despite the complex underlying implementation. The methods for tweening on JTweenControl provide all the possible parameters for a tween transformation.

It places a focus on performance by attempting to shift the processing of tween data and applying that data to tween targets on Job worker threads. This currently applies to Transforms only, but as the Entity-Component System of the Unity DOTS stack reaches maturity this approach can likely be applied to other components and non-Job updateable components will be added regardless. It places a focus on performance by attempting to shift the processing of tween data and applying that data to tween targets on Job threads. This currently applies to Transforms only, but as the Entity-Component System of the Unity DOTS stack reaches maturity this approach can likely be applied to other components. By design, most tweens are played automatically once created and cleaned up once completed.

Better yet, if you can provide a reproducible example that can be used to demonstrate the issue it will be much more likely that the issue is addressed quickly. When importing JTween via this Unity Package only, make sure to also import the following native Unity packages at the referenced versions. There is an .editorconfig at the root of the repository that can be used by most IDEs to help ensure these settings are automatically applied. This structure allows for ease of development and quick testing via master or develop, but clear isolation and separation between the package distribution via releases/stable. It involves importing the plugin, adding any AssemblyDefnition references as needed, and importing its namespace into any script that you want to use the JTween API. If at runtime JTweenControl does not exist, it will be created the first time any type of tween is created.