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

Event driven design #39

Closed
smygarn opened this issue Jul 10, 2016 · 6 comments
Closed

Event driven design #39

smygarn opened this issue Jul 10, 2016 · 6 comments

Comments

@smygarn
Copy link

smygarn commented Jul 10, 2016

Event driven design should be implemented to all controls.

For example in a slider:

    public delegate void ResultAction(string tag, float value);
    public event ResultAction OnResultChanged;
    float previousValue;

 if (previousValue != CurrentValue)
        {
            previousValue = CurrentValue;
            if (OnResultChanged != null)
            {
                OnResultChanged(tag, CurrentValue);
            }
          }
@zite
Copy link
Member

zite commented Jul 10, 2016

I think we probably will implement this soon. Going to look at using UnityEvents instead though, they seem pretty nice.

@smygarn
Copy link
Author

smygarn commented Jul 13, 2016

Great. Looking forward to upcoming updates. Do you have any plans of a slack channel to be able to expand the community around this?

@omgwtfgames
Copy link

I started implementing some events like this for item attachment/detachment too (eg omgwtfgames/NewtonVR@e4bf5ed...feature/onattach-events ).

It's not yet cleaned up as a proper pull request though since I haven't done things consistently - I started by using plain old delegate events on AttachJoint but then used UnityEvents on InteractableItem. I think UnityEvents is probably the better option since the Inspector integration can be useful and I don't see any significant disadvantages.

Some discussion about how we should implement this consistently across the library would be good.

@flarb
Copy link

flarb commented Aug 19, 2016

Yeah this is 100% needed. I had a bunch of this setup for my old hand control library that I'd like to move over to this.

@rpgwhitelock
Copy link

rpgwhitelock commented Aug 23, 2016

Another nod for this. I use UnityEvents heavily in my own script framework - they are incredibly useful! Can hook up simple behaviours in the inspector without compiling. Very convenient when adding general polish and effects too.

@naabel
Copy link
Contributor

naabel commented Sep 9, 2016

Closed, see Trello card (https://trello.com/c/OI53wkQo)

@naabel naabel closed this as completed Sep 9, 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

6 participants