(Week 23) LET'S COALESCE??


SUMMARY:

  • STORE ITEM MOUSE HOVER- We got item descriptions to update in realtime.
  • COALESCING??- A clean and simple way to live and program.
  • MOUSE HOVER MAGIC- We wrote a button.onHover() script you can download and use.
  • TASK TRACKER GOLD IN 1 WEEK (AGAIN, AGAIN) - Continuing to add teams members as our ultimate feature.


PLAY THE GAME


STORE ITEM MOUSE HOVER

This week we added a mouse hover mechanic in the store so you get more details about the upgrade items you're buying. Originally we wanted to move on to get shoe upgrades working (shoe betcha!) but unfortunately it felt important to make this work. On the flipside, our store system is done and we can move on to upgrades next week instead, nonetheless the delay was worth it.

COALESCING??

One thing we learned was the coalescing operator. It's a fancy way of saying "if null, then do this". But as you can see from our example below, it helps to keep our code clean and simple as well as easier to maintain.


Example

<br> //Long version <br><br> Button myButton= button.GetComponent<MyCompoment>() ? button.GetComponent<MyCompoment>() : button.gameObject.AddComponent<MyCompoment>();<br>


<br> //Simple version with COALESCING<br><br> Button myButton= button.GetComponent<MyCompoment>() ?? button.gameObject.AddComponent<MyCompoment>();<br> <br>

One thing I've learned in my career is that it's better to take your time and keep your code clean as early as you can, even if it takes longer. This way, it'll stand the test of time and you won't end up wasting hours, maybe days, trying to figure out what your past self was trying to do. Spaghetti is great for lunch, bad for code.

MOUSE HOVER MAGIC

BEFORE



AFTER


You can see above a MAJOR improvement in how mouse hover works. Unity doesn't have a Button.onHover() event, so we wrote one ourselves. Long story short, we extended the functionality of the Unity Button by making our custom script act as a wrapper. It adds events for OnHover and OnExit. To make this work we attach our script to the button prefab.


TASK TRACKER GOLD IN ONE MORE, ONE MORE, ONE MORE WEEK

The Team Invite feature is STILL taking longer than expected (any day now) but it's close. Here you see our contact search feature working. You can find any current members of your team and add them.


If they're not in our directory, the notifications window prompts you to send then an invite so they can open an account and join your team!


We're hoping to make it easier than ever to have friends join you in keeping track of goals or tasks for your project. Our test run worked well this week but deployment may take a little longer, perhaps by the weekend or early next week.


Visit Task Tracker's Public TODO List and sign up FREE!

That's it for this week! Hope you try out the game and check out our list on Task Tracker Pro! To be continued....

GabeArts305

Leave a comment

Log in with itch.io to leave a comment.