Search Unity

How do I learn how all this stuff works?

Discussion in 'Project Tiny' started by tbriley, Dec 14, 2018.

  1. tbriley

    tbriley

    Joined:
    Sep 10, 2013
    Posts:
    112
    In addition to the forums and slack, one of the best ways to learn the nuances of core ECS + Jobs is to dig into things like TransformSystem and the example systems while watching loads of Unite videos. There is also (improving) documentation. It was a little painful but didn't take all that long to figure out how jobs + systems + chunks and all that fit together.

    I was very excited to start digging into Project Tiny and am really impressed with what I've tried so far. But I'm having a bit of a difficult time figuring out how to take the next step and building on top of what's there. Part of that is typescript (and my inexperience with it), but part of it is that I don't understand how the core bits are packed away - I find exploring difficult.

    A few examples might be more clear:

    1. I want to start adding some basic animations + tweening when a button is clicked. I go to the Match 3 project, as I recall seeing plenty of animation and ui kinds of things there. I find the WorldMap entity group and inspect ButtonLeft and see its components. Great! I can also inspect the CustomButtonSystem. But I have no idea what MouseInteraction is or how it works or what all it's properties are - typescript tells me some things but I'm at a bit of a loss as to how to build my own AnimatedButtonSystem from here.

    2. I'm back in my project now, but keeping the samples loaded because I'm still heavily in learning mode. It's really unclear here how to consume components and systems from other projects - it seems I can't even inspect components from another namespace or project?

    3. Will it be possible soon to query a scene / entity group for existing components? Ie, type in 'Button' in the hierarchy view and see all the entities that have a Button component attached?

    Hope this isn't taken the wrong way, really like what's there so far and looking forward to seeing this mature over the next year, cheers!
     
  2. martinpa

    martinpa

    Unity Technologies

    Joined:
    Oct 18, 2017
    Posts:
    6
    Hi, concerning point 3, it is possible to query the entity group with a component filter. To do so, you must prefix the component type name with c:
    c:TransformNode
    will return all the entities with a TransformNode.​

    You can also apply some modifiers. For example, ! will invert the filter.
    c:TransformNode c:!TransformLocalPosition
    will return all the entities that have a TransformNode, but do not have TransformLocalPosition.
    Note that the search will succeed if the component type name contains the name you provided. That allows to search for multiple component type with one query.
    c:Transform
    will return any entity that has at least component whose name contains Transform.​

    Another useful modifier is ^, which means either starts with or ends with, depending on where it is placed.
    c:2D^
    matches any component that ends with 2D
    c:^Sprite
    matches any component that starts with Sprite.​

    Also note that these modifiers also work for entity names.
     
    Last edited: Dec 14, 2018
    tbriley likes this.
  3. TheRoccoB

    TheRoccoB

    Joined:
    Jun 29, 2017
    Posts:
    54
    I can't promise this will work, but you might be able to see some properties and methods (better than with just autocomplete) by using Chrome developer tools to set breakpoints and inspect objects.

    I briefly cover how to look at devtools and set breakpoints for Tiny in the second half of this vid (http://bit.ly/2SL4udJ) Let me know if the inspections in chrome give you any extra info... Curious myself.
     
    Shorely likes this.
  4. tbriley

    tbriley

    Joined:
    Sep 10, 2013
    Posts:
    112
    Very cool!

    Excellent, will give this a try tomorrow.
     
  5. tbriley

    tbriley

    Joined:
    Sep 10, 2013
    Posts:
    112
    @TheRoccoB i was a bit delayed, but finally had a chance to play around with this. indeed it looks like runtime debugging opens up some things that make it easier to see how all this is working, thanks for the tip ;)
     
    Shorely likes this.
  6. TheRoccoB

    TheRoccoB

    Joined:
    Jun 29, 2017
    Posts:
    54
    @tbriley excellent thanks for the confirmation!