Open andrewle9510 opened 1 year ago
Ahoy, I can't make a test right now but could you try to cast the change value to a Vector3? That should fix it in theory.
Hi Demigiant, unfortunately dotween gave me an error, not a warning. it does not allow to use Vector3
Ahoy, Sorry from the phone I didn't realize we werre talking about a rigidbody2d (even if it was in the title, agh) so Vector3 didn't make sense. I just made this test and it all works perfectly:
IEnumerator Start()
{
Tweener t = rigibody2d.DOMove(new Vector2(2, 0), 2);
yield return new WaitForSeconds(1);
t.ChangeEndValue(new Vector2(-2, 0), 2, true);
}
What do you mean by not working? If nothing seems to happen then maybe some calculations like distance are going wrong?
I also made this test to check OnUpdate and it works perfectly too (though I made sure the value wasn't changed repeatedly):
void Start()
{
Tweener t = rigibody2d.DOMove(new Vector2(2, 0), 2);
bool valueChanged = false;
t.OnUpdate(() =>
{
if (!valueChanged && rigibody2d.position.x > 1) {
Debug.Log("Changing value");
valueChanged = true;
t.ChangeEndValue(new Vector2(-2, 0), 2, true);
}
});
}
Hi, i try to make enemy follow player. those code i posted, it gave no warning or error. but the enemy does not even move. i think it is not the distance problem, because i change the rb2d => transform. it works like a charm. i think maybe the casting from vector3 => vector2 is the problem, because when i dont cast, the enemy did move. but not change the end value because it requires vector2 instead of vector3.
I'm confused as to why this wouldn't work other than external factors. Could you make a barebone project that replicates this issue and send it to me, so I can test it out?
this is my code. please help me