prime31 / gokit Goto Github PK
View Code? Open in Web Editor NEWLightweight tween library for Unity
Lightweight tween library for Unity
Currently, localEulerAngles behave the same as eulerAngles.
public GoTweenConfig localEulerAngles( Vector3 endValue, bool isRelative = false )
{
var prop = new EulerAnglesTweenProperty( endValue, isRelative );
// ....
}
Should be
public GoTweenConfig localEulerAngles( Vector3 endValue, bool isRelative = false )
{
var prop = new EulerAnglesTweenProperty( endValue, isRelative, true );
// ....
}
For games that have a full-state save system, where basically everything non-static is saved on user request, is there a way to also save all currently running tweens? Is this built into the lib or something we would need to implement ourselves? (We already have a full-state save system.)
Thank you!
In a case where where I wish to use a tween to position a transform to a given point immediately by setting duration = 0f, unity will throw up errors due to division by zero.
I have a TweenConfig that tweens the position of a Transform and manually sets a different final position in the onComplete handler. This final position is being overwritten in a final call to tick() in Tween.update() even though AbstractTween.update() is returning true.
I would expect onComplete to be the very last thing to be called before the tween is destroyed
I have a number of related tweens which should run simultaneously and, sometimes, be canceled halfway collectively. I was hoping to use some kind of collection (GoTweenFlow seems promising) to manage these tweens, but AFAICS I can then only pause the tweens, not actually stop / destroy them through the collection. I would have to keep a separate list of tweens to call destroy() on, pretty much voiding the goal of the collection.
Am I missing something, or is this something that could/should be added?
When using Unity 4, and trying to use GoKit Visual Path Editor, many of the features do not appear to work correctly. Namely:
-Curved paths are not visible unless the gameObject is deselected (essentially becoming useless). Paths do appear, however, when 'Force Straight Lines' is ticked.
-Snapping of the handles doesn't work
For health progress bar when multiple tweens get launched at time when one tween is already running.
Thank you !
Since this isn't in the asset store, I'm trying to figure out the best way to install it, without simply cloning it and adding all the files to my project (though perhaps that's the best way?).
I haven't been successful going to the Package Manager and clicking on "Add from Git URL" and entering "https://github.com/prime31/GoKit.git"
What is the best way to install this plugin?
Thanks.
i use gokit with 2d tool kit.
i want to change tk2d sprite's alpha . 0 -> 255.
tk2dSprite mysprite;
mysprite = GetComponent();
//tween1 this function is well
GoTween tween1 = new GoTween(mysprite, 1f, new GoTweenConfig().colorProp("color",new Color(255,255,255,0)));
//this function is not good
GoTween tween2 = new GoTween(mysprite, 1f, new GoTweenConfig().colorProp("color",new Color(255,255,255,255)));
when tween1 , gradually mysprite color alpha becameing 0 .
when tween2 , suddenly mysprite color alpha 255.
what should i do ?
Hi team,
Have you considered making a variant which supports ECS?
Hi Mike,
A suggestion for a small change to the license. There's a bit which currently reads:
You can freely use it in as many games as you would like but you cannot distribute the source code either directly or compiled into a library outside of your game.
This would actually preclude anyone from forking it to send you pull requests (something I just did) since that counts as distributing the source directly outside a game. Perhaps it would be best to change it to read commercially distribute.
When I add (using visual editor at least) 4 or more nodes to a path the Begin and End nodes are never used.
The movement starts from the Node 1 and goes to Node n-1 (Before the End node).
I am using Unity 4 beta 7.
GoDummyPathEditor:128
if( path.splineType != GoSplineType.CatmullRom )
instead of
if( path.splineType == GoSplineType.StraightLine )
In Demo Scene - KitchenSinkManager:
// Progress/Health bar
var progressBar = UIProgressBar.create( "progressBar.png", 0, 0 );
progressBar.positionFromBottomLeft( .05f, .02f );
progressBar.resizeTextureOnChange = true;
progressBar.localScale = new Vector3(1,1.5f,1); <<just add this line
progressBar.value = 0.4f;
the result is not expected...
I have try
progressBar.scale = new Vector3(1,1.5f,1); <<same result
Hey guys. As you may know, Apple just began enforcing the inclusion of 64-bit architecture in all ios submissions. For those created in Unity, this requires using the 'IL2CPP' scripting backend rather than 'Mono 2.1' in order to enable 'Universal' in the Architecture Settings.
Does Prime31 have any plans to update GoTween to accommodate this new restriction? Presently it works fine in the IDE, but most tweens cause errors on iOS.
Testing GoKit on my game I deployed to an Android phone and found that the Assets where not loading . I made some modifications to the original method in charge of handling the loading process and managed to get it working.
Since I don't use Git here is the solution: (replace the current method with the code bellow)
Class: GoSpline.cs
/// <summary>
/// helper to get a node list from an asset created with the visual editor
/// </summary>
private static List<Vector3> nodeListFromAsset( string pathAssetName )
{
Debug.LogError( "The Web Player does not support loading files from disk." );
return null;
var path = string.Empty;
if( !pathAssetName.EndsWith( ".asset" ) )
pathAssetName += ".asset";
byte[] bytes = null;
if (Application.platform == RuntimePlatform.Android)
{
path = Path.Combine("jar:file://" + Application.dataPath + "!/assets/", pathAssetName);
WWW loadAsset = new WWW(path);
while (loadAsset.isDone) { } // maybe make a safety check here
bytes = loadAsset.bytes;
}
else
{
if (Application.platform == RuntimePlatform.IPhonePlayer)
{
// on iOS at runtime, we load from the dataPath
path = Path.Combine(Path.Combine(Application.dataPath, "Raw"), pathAssetName);
}
else
{
// default to looking in the StreamingAssets folder
path = Path.Combine(Path.Combine(Application.dataPath, "StreamingAssets"), pathAssetName);
}
bytes = File.ReadAllBytes(path);
}
return bytesToVector3List( bytes );
}
Hi. Is it possible to tween a value without converting it to a property?
say 0 to 1. LeanTween has a similar feature for most types. Here is an example
LeanTween.value(gameObject, (float val) => {
canvasGroup.alpha = val;
}, 1, 0, tweenTime);
If I want to tween a local euler rotation from 355,0,0 to 5,0,0, GoKit will calculate the distance as -350,0,0. Is there a way to get it to tween a distance of 10,0,0?
Probably more of a feature request, but pausing a tween after calling goTo does not update the transform rotation. Any way of accomplishing this?
In commit 998f082 there were preprocessor ifs added for when building for Win8/WP8 these don't work with out adding System.Reflection tot he file, also I don't see where NET_CORE gets defined?
I'm saving instances of tweens that need to be reused often, with minor TweenProperty changes. Here's what my code looks like:
// declaration as a field of my class
private GoTween _myTween;
// setup
var config = new GoTweenConfig().setEaseType(GoEaseType.CircOut).startPaused();
_myTween = new GoTween(_myTarget, 1.0f, config);
_myTween.autoRemoveOnComplete = false;
Go.addTween(_myTween);
// use
int newValue = Random(0, 100); // same tween, but a different value each time
_myTween.clearTweenProperties(); // get rid of old properties from last use
_myTween.addTweenProperty(new IntTweenProperty("MyIntProperty", newValue));
_myTween.goToAndPlay(0.0f); // play from the start
This works the first time the tween is used, but after that, the value set by the tween is always 0 instead of newValue
.
From debugging, it looks like the newly added TweenProperty is never getting its prepareForUse()
method called, which normally happens in GoTween's onInit()
. I think either prepareForUse()
should be called on new properties added via addTweenProperty()
if the GoTween's _didInit
is true, or there should be exposed a Reset()
method to set the _didInit
field back to false on the GoTween, so it will properly call prepareForUse()
on all TweenProperties.
I'll experiment with these fixes and submit a pull request once I have a proper fix, but it would be nice to hear from an author with more knowledge of the code as to what the best solution is.
I'm trying to play the tweenchain backwards but somehow it only plays forward but when i do playBackwards() it's doing nothing.
One more thing, is it possible to remove a tween from chain after appending it ? thanks
Is it possible to change to the speed/during of a GoTween/GoTweenChain while it is playing?
I'm wanting to be able to change the speed of only certain aspects in my game, including my GoTweens/GoTweenChains even if they are already playing.
GoMaterialColorType enum is a bit misguided. Shaders can use any string as a color variable name, so restricting the identifier to an enum is useless for many cases. In fact many stock Unity shaders use names that are not present in the enum (ie. "_TintColor"). Adding more elements to the enum will not fix the problem for anyone using custom shaders with masks/toon outlines/whatever.
People are used to supplying the full string when using Material.SetColor. It would be idiomatic to use a string here as well.
I'll make the fix and create a pull request if people agree.
Should I support the enum for back compatability or just remove it completely?
I have a lot of objects and each running tweens, its a game like candy crush. The question is, is it possible to check if all tweens have completed without using each objects tween, like from "GoKit" instance in the scene or something?
Please give an example.
I have my projects set up where I clone different repos, with different components or functionality, into the main repo via git submodule functionality. The GoKit repo, being an entire Unity project, is not suited to doing that. Sparse-Checkout also results in a rather messy directory structure because it must create all directories from root. What do you think of the idea of making this repo, and potentially others, organized into a structure that allows someone to git submodule add, or git subtree add them into their project directly?
Hi prime31, I created a small enhancement to the Editor class so we can move the nodes to start at the location of the GameObject where the GoDummyPath is.
I added this script just bellow this script block:
if( GUILayout.Button( "Shift Path to Start at Origin" ) ) { ... }
Here is the code:
// shift the start point to the GameObject where the GoDummyPath is
if (GUILayout.Button("Shift Path to Start at Object"))
{
Undo.RegisterUndo(_target, "Path Vector Changed");
var offset = Vector3.zero;
// see what kind of path we are. the simplest case is just a straight line
var path = new GoSpline(_target.nodes, _target.forceStraightLinePath);
if (path.splineType == SplineType.StraightLine)
offset = _target.transform.position - _target.nodes[0];
else
offset = _target.transform.position - _target.nodes[1];
for (var i = 0; i < _target.nodes.Count; i++)
_target.nodes[i] += offset;
GUI.changed = true;
}
I hope you add this to the branch. I found this very useful to observe the path when creating some spawn nodes in my game and reusing previously saved paths.
You may want to create a method that receives the start position Vector3 as an argument to avoid code duplication in both buttons (Shift Path to Start at Origin and this new one I created)
Hi, I'm trying to create a simple system with a path that follows my player when they are moving. This leads me into my question, is there a method that would allow me to get the closest point on a path from a gameobject's transform.
Here you can see my totally professional explanation made with paint on what I'm trying to accomplish.
The image is in 2D for obvious reasons but the same would apply in a 3d space.
The following link http://prime31.com/unity/docs/#goKitDoc don't seems to work anymore.
Just a request to update the wiki on this github to use the GoTween class instead of what I assume is the old Tween() API (such as in the Basics page). It confused me for awhile when trying to learn the API.
It seems that in some situations (heavy load), the GoTweenChain ends before the last GoTween in its chain. And when it happens, the onComplete handler of the last GoTween is not called.
in GoSpline.cs nodeListFromAsset
....
path = Path.Combine( "jar:file://" + Application.dataPath + "!/assets/", pathAssetName );
WWW loadAsset = new WWW( path );
while( loadAsset.isDone ) { } // maybe make a safety check here <<<<
...
I think this should be while not
while(!loadAsset.isDone) {}
If you want to call a function at a given point in a GoTweenChain
or GoTweenFlow
, you currently have to wrap the function in a GoTween
object to add it to the collection.
new GoTweenChain()
.appendDelay(1)
.append(new GoTween(this, 0, new GoTweenConfig().onBegin(x => MyFunction()));
I'm wondering if GoKit should include a more explicit way of inserting functions into collections. Some potential ways of doing this could be:
GoTween
object, eg. GoTweenUtils.Function(x => MyFunction())
GoTweenChain
and GoTweenFlow
for inserting functions, such as GoTweenChain.appendFunction()
, GoTweenChain.prependFunction()
, and GoTweenFlow.insertFunction()
Thoughts?
using the version from Unity Store and Unity 4.6 rc1
In GoDummyPathEditor.cs
I had to set:
#if NETFX_CORE
using UnityEngine.Windows.File;
#else
using System.IO;
#endif
In GoSpline.cs 98
I had to set:
var bytes = new byte[1]; //File.ReadAllBytes( path );
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.