Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.

    Read our full announcement for more information and let us know if you have any questions.

webplayer loading multiple external html with unity embed

Discussion in 'Multiplayer' started by Checco-Esimple, Feb 21, 2008.

  1. Checco-Esimple


    Feb 14, 2008

    we are developing a big web project with unity3D. (sorry for the long post)

    the final project will be a virtual trade center, with shops inside.

    We have created one level with the virtual center loaded into, with multiplayer support (to use the chat feature between the users), so the user loads the webpage and logins inside unity.

    we use the webplayer streaming feature to load the level only after the login (and avatar choose)

    But now we have a problem because external assets are not loadable by the webplayer

    We need to make some shops fully walkable, but we can't load inside the main level (because we need to use it on the "web", we need to keep the size low ), so we have created multiple assets loaded into different web pages.

    the main idea is to load the webpage, keeping the main level connection open to keep the position of the player and the server connection

    we have tried different ways to do this:

    the first one is the use of application.openurl, but it loads the new webpage inside the main html and it destroye all the server connection. Taking back to the previous html it goes to the login page. We have also used the cookie feature to keep the position of the player inside the main level, but the streaming player loads everytime all the main level.

    the second one is the use of application.externalevalue and application.externalcall to open a new window using javascript, but the first problem is the popup blocker of the modern web browser, the second one is the ugly frame rate, because two unity players are opened simultaneously.

    the third one is the use of layer visibility, we have created two divs with unityembed. On the first one we call the main level, and the second one (hidden) is filled by javascript when user clicks on the shop (and also switches layer visibility). The unity plugin executes the display:none function in the same manner of close window.

    so we have tried to shrink the size of the first div to 1 pixel (instead of using display:none function), but the two embeddings remain loaded in memory (so we get CPU and memory problem in client side and ugly framerate).

    we need a solution to keep the main level size as low as possible and not destroy the player position and networking connection.

    a solution should be a sort of "pause" function that freeze the main level when showing the second one on the main div, but we don't know how to do it.

    note: we don't need a server connection inside the external shops, but only on the main level.
  2. larus


    Unity Technologies

    Oct 12, 2007
    I don't know much about web integration like this but here's an idea anyway.

    You could make the server assign the player or current user a unique identifier which points to all his information (position, etc), the identifier is returned to the user via RPC. Then when you "pause" the player you just shut it down completely (killing the connection), substitute it with an image or something (I'm not sure I 100% understand your scenario). Then when you want to unpause you make the user login again with his unique identifier, thus he has all is previous information and has the exact same state as before. You might not even need the unique identifier thing but just make the users client remember all his information (user name, position, etc) and reregister them upon unpausing and reconnecting to the server. I guess its kind of like using cookies to remember users.