Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by DAVco · Mar 04, 2017 at 09:06 AM · c#erroreventsnative pluginc++

IUnityEventQueue - how do I use it?

I am currently writing a C++ native plugin for my Unity application.

I've came across the IUnityEventQueue.h file in the UnityPluginAPI folder, but documentation is pretty thin on the ground - do some docs and/or examples exist for writing native plugins that use it?

What I want to do is; issue an event from my Unmanaged code that is then picked up on the Unity main thread in Managed code - is this possible? Currently I am achieving this with Unmanaged->Managed callbacks, but I would prefer to use a more robust solution if one exists. From the comments in the IUnityEventQueue.h file, this sounds like it may be possible, but there are no examples of how to achieve this.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image hexagonius · Mar 04, 2017 at 10:04 AM 0
Share

neither google nor any search engine spit out something else than this question and your forum post about IUnityEventQueue. So I'm pretty sure the way plugins are supposed to be created is like the processes described in the manual pages.

avatar image DAVco · Mar 06, 2017 at 10:48 AM 0
Share

While I can definitely do what I want by handing callbacks myself, the comments in the IUnityEventQueue file seems to suggest that it is designed for exactly the scenario I want to use it for;

-5.2 patch 1 + of Unity will support this. The Unity EventQueue is a standard way of passing information between plugins or parts of the engine without any reliance on managed systems, game objects or other pieces of Unity. Events are simply a structure and GUID pair. GUIDs were chosen rather than hashes as it allows plugins to define their own event payloads and use the EventQueue. While the EventQueue itself is self contained and can be used for many different applications within Unity the global event queue that is passed to plugins is always serviced on the main simulation thread and thus serves as a convenient means of pushing asynchronous operations back to the main game thread

Since there is no manual page, perhaps it is a feature that is not yet ready for a full release?

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by yi-li · Apr 28, 2017 at 05:52 AM

You are on the right track, the IUnityEventQueue.h described everything you need know to use it. RegisterEvent

Fire when you want

use static class based eventhandler to catch these events (pass to main thread etc...)

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by bleater · Jul 17, 2020 at 05:04 AM

The comments in the header make explicit mention of a "global event queue", even naming it in the UnityEventSystem namespace GlobalEventQueue::GetInstance ().SendEvent (evt);. But it doesn't appear anywhere in the header, so I'm mystified how this is supposed to work.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Distribute terrain in zones 3 Answers

formatting errors converting this code! 2 Answers

DirectX11 get handle to Unity Swapchain/Backbuffer 0 Answers

Access Unity Script Function From External Program 1 Answer

Using Native C++ dll in Unity 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges