1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2026-02-09 08:38:45 +08:00

Fixed GotoWaypoint throwing an exception if called immediately after a path tween creation, before it could startup

This commit is contained in:
Daniele Giardini 2015-03-25 12:35:48 +01:00
parent ec1756130a
commit 443a0b1d40
15 changed files with 18 additions and 10 deletions

View File

@ -675,7 +675,7 @@
<summary>Send a path tween to the given waypoint.
Has no effect if this is not a path tween.
<para>BEWARE, this is a special utility method:
the lookAt direction might be wrong after calling this and might need to be set manually
it works only with Linear eases. Also, the lookAt direction might be wrong after calling this and might need to be set manually
(because it relies on a smooth path movement and doesn't work well with jumps that encompass dramatic direction changes)</para></summary>
<param name="waypointIndex">Waypoint index to reach
(if higher than the max waypoint index the tween will simply go to the last one)</param>

View File

@ -675,7 +675,7 @@
<summary>Send a path tween to the given waypoint.
Has no effect if this is not a path tween.
<para>BEWARE, this is a special utility method:
the lookAt direction might be wrong after calling this and might need to be set manually
it works only with Linear eases. Also, the lookAt direction might be wrong after calling this and might need to be set manually
(because it relies on a smooth path movement and doesn't work well with jumps that encompass dramatic direction changes)</para></summary>
<param name="waypointIndex">Waypoint index to reach
(if higher than the max waypoint index the tween will simply go to the last one)</param>

View File

@ -675,7 +675,7 @@
<summary>Send a path tween to the given waypoint.
Has no effect if this is not a path tween.
<para>BEWARE, this is a special utility method:
the lookAt direction might be wrong after calling this and might need to be set manually
it works only with Linear eases. Also, the lookAt direction might be wrong after calling this and might need to be set manually
(because it relies on a smooth path movement and doesn't work well with jumps that encompass dramatic direction changes)</para></summary>
<param name="waypointIndex">Waypoint index to reach
(if higher than the max waypoint index the tween will simply go to the last one)</param>

View File

@ -11,16 +11,22 @@ using System;
public class TempTests : BrainBase
{
public Transform target;
public Ease easeType;
public float gotoTime;
public Vector3[] waypoints;
Tween t;
IEnumerator Start()
{
yield return new WaitForSeconds(0.6f);
Tween t = target.DOPath(waypoints, 5);
yield return null;
yield return null;
t = target.DOPath(waypoints, 5, PathType.CatmullRom).SetEase(easeType);
t.GotoWaypoint(2);
}
void OnGUI()
{
if (GUILayout.Button("Goto")) t.Goto(gotoTime);
}
}

View File

@ -21,7 +21,7 @@ namespace DG.Tweening
public class DOTween
{
/// <summary>DOTween's version</summary>
public static readonly string Version = "1.0.345";
public static readonly string Version = "1.0.346";
///////////////////////////////////////////////
// Options ////////////////////////////////////

View File

@ -5,6 +5,7 @@
// This work is subject to the terms at http://dotween.demigiant.com/license.php
using DG.Tweening.Core;
using DG.Tweening.Core.Easing;
using DG.Tweening.Plugins.Core.PathCore;
using DG.Tweening.Plugins.Options;
using UnityEngine;
@ -212,7 +213,7 @@ namespace DG.Tweening
/// <summary>Send a path tween to the given waypoint.
/// Has no effect if this is not a path tween.
/// <para>BEWARE, this is a special utility method:
/// the lookAt direction might be wrong after calling this and might need to be set manually
/// it works only with Linear eases. Also, the lookAt direction might be wrong after calling this and might need to be set manually
/// (because it relies on a smooth path movement and doesn't work well with jumps that encompass dramatic direction changes)</para></summary>
/// <param name="waypointIndex">Waypoint index to reach
/// (if higher than the max waypoint index the tween will simply go to the last one)</param>
@ -232,6 +233,7 @@ namespace DG.Tweening
if (Debugger.logPriority > 1) Debugger.LogNonPathTween(t); return;
}
if (!t.startupDone) TweenManager.ForceInit(t); // Initialize the tween if it's not initialized already (required)
if (waypointIndex < 0) waypointIndex = 0;
else if (waypointIndex > pathTween.changeValue.wps.Length - 1) waypointIndex = pathTween.changeValue.wps.Length - 1;
// Find path percentage relative to given waypoint

View File

@ -675,7 +675,7 @@
<summary>Send a path tween to the given waypoint.
Has no effect if this is not a path tween.
<para>BEWARE, this is a special utility method:
the lookAt direction might be wrong after calling this and might need to be set manually
it works only with Linear eases. Also, the lookAt direction might be wrong after calling this and might need to be set manually
(because it relies on a smooth path movement and doesn't work well with jumps that encompass dramatic direction changes)</para></summary>
<param name="waypointIndex">Waypoint index to reach
(if higher than the max waypoint index the tween will simply go to the last one)</param>

Binary file not shown.