Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

@ut.requiredComponents - When do I use it?

Discussion in 'Project Tiny' started by Rocco_B, May 30, 2019.

  1. Rocco_B

    Rocco_B

    Joined:
    Oct 28, 2016
    Posts:
    34
    I've been following along and adapting some of the examples from Project Tiny. In the FlyingYolk example there is a ScrollSystem with the following line

    @ut.requiredComponents(ut.Core2D.TransformLocalPosition, game.Scroller)


    I had thought that this decorator would stop the system from running unless those components were present in the scene but it seems like the update (outside of the foreach) is still called.
    1. What does this decorator actually do and is it something that is required?
    2. Is this any different then providing the filter inside the world.forEach?
     
    Ferran_SP likes this.
  2. reallyhexln

    reallyhexln

    Joined:
    Jun 18, 2018
    Posts:
    69
  3. Rocco_B

    Rocco_B

    Joined:
    Oct 28, 2016
    Posts:
    34
    Ahh ty. I tried searching the forums before posting this but I guess my searchfu was too weak! :p