Skip to content

Does window.dispatchReactUnityEvent() return a value? #539

Discussion options

You must be logged in to vote

I think I answered my own question by looking at the actual code for dispatchReactUnityEvent. Doh!

const dispatchReactUnityEvent = (
  eventName: string,
  ...parameters: ReactUnityEventParameter[]
): ReactUnityEventParameter => {
  // Loops through all of the mounted event systems and dispatches the event.
  // In case there are multiple event systems, the return value origin is
  // undefined.
  let returnValue: ReactUnityEventParameter = undefined;
  mountedEventDispatchers.forEach((dispatchEvent) => {
    returnValue = dispatchEvent(eventName, ...parameters);
  });
  return returnValue;
};

Should have an example for this in the docs.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jeffreylanters
Comment options

Answer selected by jeffreylanters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants