Search Unity

Question Issue with rotating the object

Discussion in 'Shader Graph' started by FMT_WL, Dec 13, 2019.

  1. FMT_WL

    FMT_WL

    Joined:
    Oct 7, 2018
    Posts:
    3
    Hey guys, so I'm attempting to use Shader to rotate the roller instead of using animator for testing purpose. But I'm not too sure why I'm getting two different behavior in the prefab and in the scene??

    If you look at the gif below, the roller behave fine in the scene view, but it have completely different behavior in game view. Originally I thought I've set the position node to world, but turns out it was at object the whole time.

    My understanding of the setup was, if I pass the position of the object to Rotate About Axis, it should rotate on the given axis on that particular position isn't it?
    upload_2019-12-14_2-20-51.png

    I'm fairly new to Shader Graph so any thoughts on this would be appreciated.
     

    Attached Files:

  2. LandonTownsend

    LandonTownsend

    Unity Technologies

    Joined:
    Aug 21, 2019
    Posts:
    35
    Hi,

    When "Static Batching" is enabled, objects of the same material that are static are combined into one mesh to save on draw calls.
    To prevent this, you can either disable Static Batching under Edit -> Project Settings -> Player -> Other Settings, or uncheck "static" on the objects.
     
  3. FMT_WL

    FMT_WL

    Joined:
    Oct 7, 2018
    Posts:
    3
    Thanks for the reply, but I actually don't have those objects static in my scene. In fact, nothing was static in my scene (which I should totally do to the props).

    But still I tried set them to static and disable "Static Batching" in player setting. It still behaving the way I was not expecting. Maybe I misunderstood how this particular Shader would work?
     
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    Could be dynamically batched too, which does roughly the same thing as static batching, but applies to low poly non-static objects.
     
  5. FMT_WL

    FMT_WL

    Joined:
    Oct 7, 2018
    Posts:
    3
    Well, enable dynamic batching doesn't help it as well, its still does that when there's more than one object with that "Rotate" material on it.
     
  6. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    You want both Static & Dynamic batching both disabled, and the meshes not set to static.

    I’ve also seen people say this is a problem when the SRP batcher is enabled, so disable that too.

    Really, this would be fixed if you could set Shader Graph shaders to not be batched, which is something you can set on shaders, but isn’t exposed by Shader Graph. :(
     
    DoubleDgames likes this.