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

Registering hovercast events #78

Closed
autuus opened this issue Jul 3, 2018 · 2 comments
Closed

Registering hovercast events #78

autuus opened this issue Jul 3, 2018 · 2 comments
Assignees
Labels

Comments

@autuus
Copy link

autuus commented Jul 3, 2018

I'm just going to ask this since I think the question is relevant for everyone. How do I properly register HoverCast events? I usually just hack around until I find a good enough solution, its usually bad for elegance.
I need to register events such as checkbox checked/unchecked, from the context of any script.

@zachkinstner
Copy link
Member

Hi @autuus! From the Items: Data and Events wiki:

Each item type has its own data component, such as HoverItemDataCheckbox and HoverItemDataSlider. These components are responsible for maintaining their item's values, and for triggering the item's events.

[...] These components all provide type-specific events, which you can use to trigger actions in your scene. These are in the Unity inspector's "Events" foldout.

You can also listen to these events via script, for example:

HoverItemDataCheckbox myCheckboxItem = /* get the item */;
myCheckboxItem.OnSelectedEvent.AddListener(MyListenerMethod);

@zachkinstner zachkinstner self-assigned this Jul 3, 2018
@zachkinstner
Copy link
Member

Related issues: #65, #68

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