Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Start game within application

Discussion in 'Editor & General Support' started by Serellyn, May 3, 2013.

  1. Serellyn

    Serellyn

    Joined:
    Sep 30, 2011
    Posts:
    104
    Hello everybody,

    I'm having this problem and I will try to explain this as clearly as I can.

    I've been asked to create an application within Unity, that can start individual games. No big deal there you think, well the thing is, the application should not be minimalized when starting the new game. So I can not just call game.exe, because that will minimalize the screen and give a flickering etc.

    What I really need is some sort of, unitypackage that can contain scripts. So when a game is build within unity, it can call the game.unitypackage in runtime and play the game. But, as far as I can tell there's no way to include scripts into the unity packages...

    So, does anyone know a way to solve my problem? Is there a way that a unity project (game) can be called from a package, including the scripts? Or maybe play a build of a game within my application, maybe as in a website, the game within a page?

    I hope I was pretty clear,
    maybe you guys can help me with this, or have other ideas on this?

    Thanks in advance
     
  2. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
  3. Serellyn

    Serellyn

    Joined:
    Sep 30, 2011
    Posts:
    104
  4. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Platform?
     
  5. Serellyn

    Serellyn

    Joined:
    Sep 30, 2011
    Posts:
    104
    Windows platform. Might it be the case that scripts don't get implemented into the assetbundles/streamedbundles because they don't get compiled? Or something?
     
  6. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    AssetBundles can't contain new scripts. They can contain objects that have scripts on them if that script is already in the main executable that you're loading it from, but you can't put new scripts into AssetBundles that aren't in the original game. If you want new scripts, Unity reccomends attaching the scripts as text objects instead of MonoBehaviors in your AssetBundle, and then have code in your main executable that uses Reflection to load that text and compile it and add it to the object that needs it, like this:

    http://docs.unity3d.com/Documentation/Manual/scriptsinassetbundles.html

    I think this would be a huge pain though if your AssetBundle has a ton of new scripts in it, like having the whole game like you're suggesting.

    Are you sure you can't just call the executable from your launcher? There are a few ways that games do it... you can minimize and then delay for a second before launching the executable so you don't see a flicker, or call the executable with a parameter to have it delay starting for a second and have the launcher actually quit so it's not running at all. I think something like that would be much easier than trying to load a game within a game.
     
  7. Serellyn

    Serellyn

    Joined:
    Sep 30, 2011
    Posts:
    104
    Thanks for the reply makeshiftwings.

    Do you have an example/tutorial of what you are describing?
    The biggest issue is that switching between executables shouldn't show the desktop etc. and maybe show a loading screen.
    It's a project for a museum, and they ofcourse do not want the kids to be able to get to the desktop. It's all touchscreen based so they can press ctrl+alt_del or anything to get to the desktop, but if it minimizes or something like that they have enough time to press the desktop. (you'll be amazed how fast kids find something to screw around with)

    The system design in my head has the following...
    Framework.exe/build which calls
    ---------------
    RFIDscan.exe/build
    Idlescreen.exe/build
    Register/Login.exe/build
    GameLauncher.exe/build which launches several games
    ----------------
    game1.exe/build
    game2.exe/build
    etc.

    So you think real builds are the solution?