Search Unity

If Scenes had a transform and input handling...

Discussion in 'Prefabs' started by Deeeds, Sep 2, 2018.

  1. Deeeds

    Deeeds

    Joined:
    Mar 15, 2018
    Posts:
    739
    ...wouldn't they provide all that nested (new) prefabs offer, in a more powerful and interesting way?

    // by input handling I mean catching, blocking and passing of input, so one scene can prevent or ensure other scenes get input, regardless of what they themselves do with any input.
     
  2. lipisis

    lipisis

    Joined:
    Jan 14, 2017
    Posts:
    37
  3. Deeeds

    Deeeds

    Joined:
    Mar 15, 2018
    Posts:
    739
    How does this give scenes their own (unique and independent) transform?
     
  4. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    973
    I don't really understand where input comes into this, seeing as the prefab has nothing to do with input either. Could you elaborate?
     
  5. Deeeds

    Deeeds

    Joined:
    Mar 15, 2018
    Posts:
    739
    Scenes as levels is one part of the reason you'll possibly want to change how and where input is directed, but it's in layering (menus, inventory screens, weapon changing system etc) where this gets super useful.

    Once you realise the fuller powers of layering scenes, the very next thing you'll want to do is control which scenes have the focus of input and/or swallow inputs, or pass them through.

    Take, for instance, a menu system that's made up of "scenes" that are equivalent to prefabs. You don't want them to let touches go through them, you'll want to swallow those touches, so to speak.

    But sometimes you'll want to pass those touches through, because parts of the scene representing the menu might not have any content within it. And that might be useful, in an RTS or other continuous play game, to permit interaction with the game world whilst still showing a menu.
     
  6. Deeeds

    Deeeds

    Joined:
    Mar 15, 2018
    Posts:
    739
    And, yes. I realise this can all be done with code and conditionals. I'm talking about a more separated and GUI focused manner in which to make independent handlers of input, with scenes as the handlers, breaking up responsibility, rather than having a 'god' class handling such things.
     
  7. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    973
    Yeah, but unless I'm misunderstanding you here, that is already possible, if you are layering scenes for UI purposes each scene will have one (or more) canvases, each one with its own raycasters. Raycasters can be enabled/disabled at will and that does result in your layers detecting and blocking input or not. Raycasting only continues to the next layer if nothing has blocked it with a lower depth anyway.

    The UI events system system already does not really rely on god classes handling inputs, or at least not on the user/developer end of things (there's still only one EventSystem instance). It can also already be used for arbitrary input handling not just UI, as it is (mostly) open source and extensible.
     
  8. Deeeds

    Deeeds

    Joined:
    Mar 15, 2018
    Posts:
    739
    You're only talking about UI.

    I mean scenes, as scenes, with input handling, and transforms of their own.

    It's my gut feeling that scenes with these two facilities solve all problems being asked of new and old prefabs, levels, and UI. But I'm only guessing and going with my gut, hence the original post's question.