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

How AsyncReactiveProperty.WaitAsync() work? #391

Closed
INFIcer opened this issue Aug 19, 2022 · 2 comments
Closed

How AsyncReactiveProperty.WaitAsync() work? #391

INFIcer opened this issue Aug 19, 2022 · 2 comments
Labels

Comments

@INFIcer
Copy link

INFIcer commented Aug 19, 2022

Why does the UniTask with index 1, 2 and 3 run only once?
I just need a method to make all UniTasks call log in each frame

public class UniTaskTest : MonoBehaviour
{
	public int taskCount = 5;
	AsyncReactiveProperty<int> Property = new AsyncReactiveProperty<int>(0);
	async UniTaskVoid Log(int index)
	{
		while (true)
		{
			await Property.WaitAsync();
			Debug.Log(index);
		}
	}
	// Start is called before the first frame update
	void Start()
	{
		for (int i = 0; i < taskCount; i++)
			Log(i).Forget();
	}
	// Update is called once per frame
	void Update()
	{
		Property.Value = Time.frameCount;
	}
}

image

@github-actions
Copy link
Contributor

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@hadashiA
Copy link
Contributor

hadashiA commented Sep 7, 2023

same as #444

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants