Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice

How does ut.Optional work?

Discussion in 'Project Tiny' started by ER_Dolleman, Mar 25, 2019.

  1. ER_Dolleman


    Dec 10, 2018
    I recently learned that ut.Subtractive can be used to exclude specific components in a world.forEach loop.

    I also noticed that there is a ut.Optional function. I tried to use it in the same way like this:
    Code (JavaScript):
    1.[game.Component1, game.Component2], [ut.Optional(game.Component3)], (comp1, comp2, comp3) => {
    2.     console.log(comp3);
    3. });
    This seems to work since it does iterate over the right entities, but the comp3 parameter is always undefined. What is the correct way of using this?