getting invoking url and params

/ Published in: C#
Save to your folder(s)

quick example of how to get invoking URL in unity

Copy this code and paste it in your HTML
  1. // dispatch message. note 'GameObject' is euphemism for whatever game object will have the script attached to it.
  2. if (Button ("Get Invoking URL"))
  3. {
  4. Application.ExternalEval(
  5. "u.getUnity().SendMessage('GameObject', 'OnInvokingParamsResponse', window.location.href);"
  6. );
  7. }
  9. // assuming this script is attached to 'GameObject' this function will be invoked
  10. public void OnInvokingParamsResponse(string res) {
  11. Debug.Log("invoking params res: "+res);
  12. }

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.