Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DoTween null reference on destroy fix #434

Closed

Conversation

Akilaydin
Copy link

Greetings!
There is an issue, that throws DoTween null reference if destroying tweened GameObject, while the tween is still playing if using extension method GetCancellationTokenOnDestroy() and pass the given token to the AwaitForComplete()/ToUniTask()/WithCancellation() methods.

Here is an extension method that solves this problem and I want to merge it into the main branch.

var token = this.GetCancellationTokenOnDestroy();

transform.DOScale(Vector3.one, 2f).WithCancellation(token); //throws null reference on destroy
			
transform.DOScale(Vector3.one, 2f).AwaitForComplete(cancellationToken: token); //throws null reference on destroy
			
transform.DOScale(Vector3.one, 2f).ToUniTask(cancellationToken: token); //throws null reference on destroy
			
transform.DOScale(Vector3.one, 2f).AwaitWithCancellation(token); //Do not throw null reference on destroy

Added new extension method that fixes DoTween null-reference, when using GetCancellationOnDestroy()
@ManuelRauber
Copy link

@neuecc Can we get this merged, also having the same issue.

Thanks :)

@kondratov-saritasa
Copy link

@neuecc I vote for this one be merged too :)

@hadashiA
Copy link
Contributor

refs: #378

@hadashiA
Copy link
Contributor

hadashiA commented Sep 1, 2023

Hi,
We are working on this problem.

About this PR,

  • The new methods you added are hard to see how they differ from the existing API. If you want to fix the behavior, it would be nice to improve it for all APIs.
  • Also, it is possible to add extended methods without merging them into the main repo.

So I'm sorry, but please let me Close.

I hope the fix in #485 will fix this issue

@hadashiA hadashiA closed this Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants