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

Suggestions/Bugs Found While Combining 2D+3D in the URP

Discussion in 'Editor & General Support' started by Ryan_PlayfulFoxGames, Apr 3, 2022.

  1. Ryan_PlayfulFoxGames

    Ryan_PlayfulFoxGames

    Joined:
    Mar 23, 2022
    Posts:
    1
    Preamble
    I made a post in General about this and asked where this should go but got no response and my post was deleted. There was also no email notification about that, I highly suggest you get some kind of email notification for when things like that happen, and there should be better direction when someone asks for it than just deleting the post.

    If this post should be made into multiple posts or moved to another thread, please let me know before deleting. Thanks.

    History
    I recently released a game, Animal Bar: Stockroom Scramble, on iOS and Android using the URP. The game is a retro/throwback LCD game. One of our goals was to get it feeling like an actual physical unit so we merged 2D and 3D techniques to create a 3D model with functioning buttons and used 2D for the game elements. In this process we found a few issues with the URP. We believe these are features that either should be incorporated into an engine meant to be Universal, or are simply things that seem to have been oversights for various reasons.

    Animations
    We found 2 animation related issues in this process. One, which is possibly a bug, but when we asked about it we were initially told it was intended behavior, but then told to send a feature request, and the other is a feature request.

    Parented Object Animation Interactions
    When you have an object with an animator and set of animations and you make it the child of another object that has an animator and animations, you can no longer edit the animations of the child object.

    In our case we had certain animations we needed an object to have related to itself and some others that we needed in relation to the parent, and as such we animated from the parent for later and from the child for the former. The issue with this, is that once parented, you cannot edit any animations on the child unless you unparent the objects. This seems like a bug...

    Feature Request: Similarly to how the Animator functions to swap when selecting different objects, the Animations should also allow for this functionality. Alternatively, a dropdown menu in the Animation window to select which Animator is currently being selected based on animators on the object and its parents would work as a solution.

    Animator State Checking
    When using the Animator in combination with code, sometimes you want to know what state you are currently in so you can perform certain tasks.

    Feature Request: It would be great if there was a function you could call to check the current animation state of an object's animator such as Animator.CurrentState(). This would allow for better workflow in cases where you want things driven based on some specific animation state but not having the animator itself be the driver, which is harder to edit, and creates more dependencies.

    Shadows
    We also had 2 issues related to shadows. One is related to how 2D and 3D interact (or don't), and the other is related to how shadows work on transparencies (or don't).

    2D -> 3D Shadow Casting
    The URP doesn't allow casting of shadows from 2D to 3D objects currently without some modification of how 2D works. In our project we were able to solve this by following a tutorial on creating a shader that allows for 2D objects to work with 3D shaders, then opening up the debug options to allow shadow casting to achieve this interaction, but this is not an ideal workflow. In scenes where someone may have semi-transparent signs with text that might be localized or scenarios like our LCD elements where you want something interactable or animated in 2D that may cast shadows in an environment (like many sci-fi themed games) this would be expected behavior.

    Feature Request: A component or checkmark boolean to allow 2D objects to cast shadows to 3D space.

    Transparent Shadow Casting
    URP doesn't allow for transparent or semi-transparent (translucent) objects, including those that use alpha clipping (like foliage) to cast shadows. This is an issue for many reasons, foliage, stained glass, plastics, etc. Given that this is supposed to be a Universal pipeline, even if this feature is expensive to render, it should be an option considering that there are so many applications for this, and it appears like a bug when things aren't casting shadows that should be.

    Feature Request: A solution to allow transparencies to cast shadows.
    Feature Request Part 2: Allow for transparent shadows to take in color value.


    Suggestion: I'm not a tech artist, but one solution may be to, in the shadow render pass, get the color data from the object casting the shadow and use the alpha to offset the darkness values or transparency on the shadows, then apply a tint based on the object's color. This wouldn't give a perfect color value for objects that have complex materials, but would at least offer a solution for large single colored surfaces such as plastics and some stained glass.
     
    m4rtin-t likes this.