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

Suggestion: consider using UniRx to make state observable #52

Closed
austinmao opened this issue Dec 21, 2016 · 3 comments
Closed

Suggestion: consider using UniRx to make state observable #52

austinmao opened this issue Dec 21, 2016 · 3 comments

Comments

@austinmao
Copy link

austinmao commented Dec 21, 2016

What do you think about making a reactive store using https://github.com/neuecc/UniRx ?

I'm trying to implement a reactive model of redux. It would be nice to do the following standard movement code outlined in https://ornithoptergames.com/reactiverx-in-unity3d-part-1/ but with a redux pattern:

  1. Observe input
  2. Dispatch input and transform to store
  3. Reducer calculates and stores velocity
  4. Renderer observes and reacts to change in state.velocity
  5. CharacterController.Move

I've done everything up until the fourth point. With Unidux as is, I have three options:

  1. I can store an observable in state;
  2. I can create a custom observable per state object; or
  3. Hack UniRx into Unidux.

However, I think it's better you may consider doing this in Store.cs > ForceUpdate() since I am relatively new to Unity development.

@austinmao
Copy link
Author

FYI here is the code I have so far for the above example: https://gist.github.com/austinmao/eaec7f1983bfc549ddd1cd7050a71e89

@mattak
Copy link
Owner

mattak commented Dec 23, 2016

OK! I'll apply UniRx.

mattak added a commit that referenced this issue Dec 23, 2016
Issues/52 Suggestion: consider using UniRx to make state observable
@mattak
Copy link
Owner

mattak commented Dec 23, 2016

Thanks a lot. I applied UniRx to Unidux keeping compatibility.

@mattak mattak closed this as completed Dec 23, 2016
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

No branches or pull requests

2 participants