Search Unity

Bug Frame drops from simple interactions

Discussion in 'XR Interaction Toolkit and Input' started by Edvism, Sep 13, 2022.

  1. Edvism

    Edvism

    Joined:
    Jun 2, 2018
    Posts:
    1
    In a basic empty VR test scene I'm getting frame drops (about 15 fps) if I have an item with a XR simple interactable and set it to change material of itself on selection. The drop happens exactly the instance the material changes and stops immediately. The materials are just basic red and green solid color ones.
    If selecting it is set do something else like disabling the mesh renderer or change the material of some other item no frame drops occur.
    EDIT: messed around trying to replicate this and it appears the deciding factor is not what item's material it is changing but which item is the last edited. I have 4 rectangles changing various item's materials and I can influence which one triggers frame drops by adding an empty script to it and then removing. The last edited item is the only one causing frame drops.

    Also similar frame drops happen when I'm moving the mouse around the Unity editor (specifically the inspector window of items with XR components) while in play mode.
     
    Last edited: Sep 13, 2022
  2. VRDave_Unity

    VRDave_Unity

    Unity Technologies

    Joined:
    Nov 19, 2021
    Posts:
    275
    @Edvism
    I would recommend using the profiler (Window > Analysis > Profiler) and capturing what happens during those material changes. That should help you narrow down what is taking up all the time during these changes. We have similar color changes in some of our samples out there and none of them have this unwanted side effect. We are also launching our XRI Template very soon, so you will have some more examples to base your work on.