Skip to content

Instantly share code, notes, and snippets.

View dylanfries's full-sized avatar

Dylan Fries dylanfries

View GitHub Profile
@dylanfries
dylanfries / Events & Delegates in Unity C#
Last active November 2, 2023 21:42
Events and Delegates for Unity (C#)
Events & Delegates
------------------
Events and Delegates were something I struggled with when I was first learning how they worked. Once I figured it out it became one of the most useful and powerful techniques for games. Its especially useful for helping to decouple classes while allowing for messaging.
Delegates - Simply a container for a function that can be used as a variable.
Events - Allows you to specify a delegate that gets called when some event in your code is triggered.
Overview
/* ********* nav *********** */
/* required for nav_mixin */
/* $nav_height: 50px */
/* $nav_button_width: 133px */
/* $button_count: 6 */
@mixin sprite($i)
width: $nav_button_width
background-position: -1 * ($i - 1) * $nav_button_width 0
&:hover