Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by Eowyn27 · Mar 10, 2014 at 05:41 PM · serversidebrowser communication

Can anyone give me an example of how unity browser communication works with .NET MVC and Unity?

I'm constantly referred to this page: https://docs.unity3d.com/Documentation/Manual/UnityWebPlayerandbrowsercommunication.html

But I'm still relatively new to web development, callbacks, AJAX, POST, etc..

So, I'd like to see an example of how everything ties together to make calls back from Unity to Browser?

For example, if I wanted the browser to detect the unity web player is still there after x amount of seconds, how do I do that without interfering with the web player functionality? Do I have to tie the script to a game object? I don;t want to run an alert every couple of seconds but a background browser/unity communication.

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Sildaekar · Mar 10, 2014 at 06:43 PM

If you are wanting to know about what goes on "behind the scenes" so to say, I would suggest reading up on TCP/IP, as far as GET, POST, etc goes try looking up more on HTTP Methods.

Comment
Add comment · Show 9 · 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 fafase · Mar 10, 2014 at 07:31 PM 0
Share

Why not use the Unity get/post system?

https://docs.unity3d.com/Documentation/ScriptReference/WWW.html

avatar image Sildaekar · Mar 11, 2014 at 07:53 AM 0
Share

I'm still relatively new to web development, callbacks, AJAX, POST, etc..So, I'd like to see an example of how everything ties together to make calls back from Unity to Browser?

I Inferred that they were asking more about protocols and the inner workings of how unity ties in with the web browser. POST, GET, etc. Are web protocols, WWW is a library that helps in using these protocols (among other things).

avatar image Eowyn27 · Mar 11, 2014 at 08:11 PM 0
Share

For example, if I wanted the browser to detect the unity web player is still there after x amount of seconds, how do I do that without interfering with the web player functionality? Do I have to tie the script to a game object and then in the script, have something fire up?

avatar image Sildaekar · Mar 12, 2014 at 12:16 AM 0
Share

In that case, if the web player is not there then the application is closed, and I would imagine the page would be closed too.

If you are wanting to make a timer to see if the player is still open after X seconds, just make a simple timer within the game. Otherwise if you are just wanting to see if the page is still open, make a Javascript(not UnityScript) timer and place it somewhere in the webpage.

avatar image Eowyn27 · Mar 12, 2014 at 08:27 PM 0
Share

For example, if I had a session time out script that will lock out my webpage after X amount of $$anonymous$$utes due to inactivity and I want it to detect that someone is hitting the web player with clicks or actions, so that it won't lock the webpage because it can't detect what's going in the unity web player. So I was wondering, what's the best way to communicate to the browser to say that, "Hey, someone's still working here" ever so often so that the user is not logged out due to inactivity with the web player on.

Show more comments
avatar image
0

Answer by fafase · Mar 10, 2014 at 06:38 PM

Well it is all in the docs. I would guess you want to have a method in your HTML file written in Javascript for instance (web js). This below goes on your html file :

 <script type="text/javascript" language="javascript">
 <!--
 function OpenUnityCom()
 {
     window.open("http://www.unity3d.com");
 }
 -->
 </script>

Then in any of your scripts, just decide where and when it should be called:

 void Start(){
    Application.ExternalCall( "OpenUnityCom");
 }

And this is all about it.

Comment
Add comment · Show 1 · 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 Eowyn27 · Mar 11, 2014 at 08:11 PM 0
Share

For example, if I wanted the browser to detect the unity web player is still there after x amount of seconds, how do I do that without interfering with the web player functionality? Do I have to tie the script to a game object?

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

22 People are following this question.

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

Related Questions

Get token back in unity 0 Answers

WWW class and Digest Authentication 0 Answers

How can i pass the post data of a server side page to unity? 1 Answer

How do I connect to a server in LAN from a different computer? I'm using socket.io and nodejs 1 Answer

Easily getting variable values from WebGL in Browser 2 Answers


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