1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2026-02-14 02:58:46 +08:00

Fixed issue with TweensById returning a NullReferenceException in some cases

This commit is contained in:
Daniele Giardini 2015-04-22 11:54:54 +02:00
parent 04e3b085fa
commit b5d1cc8853
47 changed files with 57 additions and 2 deletions

View File

@ -0,0 +1,33 @@
using UnityEngine;
using System.Collections;
using DG.Tweening;
public class PortraitToLandscapeAtRuntime : BrainBase
{
public RectTransform target;
Tween tween;
void Start()
{
CreateRTTween();
tween.Pause();
}
void OnGUI()
{
if (GUILayout.Button("Rewind")) DOTween.RewindAll();
if (GUILayout.Button("Restart")) tween.Restart();
if (GUILayout.Button("RT Recreate")) CreateRTTween();
if (GUILayout.Button("T Recreate")) CreateTween();
}
void CreateRTTween()
{
tween = target.DOAnchorPos(new Vector2(0, 50), 2).SetRelative().SetAutoKill(false);
}
void CreateTween()
{
tween = ((Transform)target).DOMove(new Vector2(0, 50), 2).SetRelative().SetAutoKill(false);
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 2ef197472500d8440ad7fad75d61a282
timeCreated: 1429640495
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 46ec2e75aee41d44c9d45f8fed38b280
timeCreated: 1429640488
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -687,7 +687,7 @@ namespace DG.Tweening.Core
List<Tween> ts = new List<Tween>(len);
for (int i = 0; i < len; ++i) {
Tween t = _activeTweens[i];
if (t.id.Equals(id)) ts.Add(t);
if (t != null && Equals(id, t.id)) ts.Add(t);
}
if (ts.Count > 0) return ts;
return null;

View File

@ -32,7 +32,7 @@ namespace DG.Tweening
public class DOTween
{
/// <summary>DOTween's version</summary>
public static readonly string Version = "1.0.605";
public static readonly string Version = "1.0.606";
///////////////////////////////////////////////
// Options ////////////////////////////////////
@ -843,6 +843,8 @@ namespace DG.Tweening
/// </summary>
public static List<Tween> TweensById(object id)
{
if (id == null) return null;
return TweenManager.GetTweensById(id);
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.