Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Instancing?

Discussion in 'Scripting' started by Nemox, Nov 29, 2012.

  1. Nemox

    Nemox

    Joined:
    Feb 16, 2010
    Posts:
    396
    So I've got a relatively simplistic splitscreen game, but one that requires each player to go into different worlds on his own.

    Let's say it's like the Sims, and in each screen, each player is building his own world separate from the others. These worlds necessarily must be in separate worldspaces from each other.

    So essentially what I want is to run multiple scenes without the scenes interfering with each other, though able to communicate with my game's core systems.

    Where in the world can I start figuring out how to do this?


    Addendum: I suppose the term "instance" is already reserved, but if you play any MMOs or the like you probably understand the type I'm talking about. xD
     
    Last edited: Nov 29, 2012
  2. BlankFoxGirl

    BlankFoxGirl

    Joined:
    Apr 26, 2010
    Posts:
    71
    You should be able to achieve this through scripting. By using identifier variables to identify what code should be ran on what partition of the screen.

    PHP:
    if(screen == 1){

    }else if(
    screen == 2){

    }
    You can then create instances of your functions and classes, and call them depending on the screen. Like;

    PHP:
    instance newInstance = new instance();
    instance.start(screen);
    It would take a lot of time depending on the complexity of your code, but it's generally not that hard to achieve.
     
  3. Loius

    Loius

    Joined:
    Aug 16, 2012
    Posts:
    546
    A necessary trick for this is using camera render layers to only draw the objects that should appear for each camera, and the physics interaction settings in Edit > Project Settings > Physics should be set up so objects in one screen won't have any physical interaction with objects in the other.

    ...

    unless you want them to. Whoa, that sounds cool.