This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class GenericToStringExts { | |
public static string ToStringExt<T>(this List<T> list) => "[" + string.Join(", ", list) + "]"; | |
public static string ToStringExt<T>(this List<List<T>> listOfLists) => "[" + string.Join(", ", listOfLists.Select(l => l.ToStringExt())) + "]"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Linq; | |
public static class GenericToStringExts { | |
public static string ToStringExt<T>(this List<T> list) => "[" + string.Join(", ", list) + "]"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class MonoBehaviourExt | |
{ | |
public static IEnumerator DelayedCoroutine(this MonoBehaviour mb, float delay, System.Action a) | |
{ | |
yield return new WaitForSeconds(delay); | |
a(); | |
} | |
public static Coroutine RunDelayed(this MonoBehaviour mb, float delay, System.Action a) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyMonoBehaviour : MonoBehaviour { | |
protected IEnumerator DelayedCoroutine(float delay, System.Action a) | |
{ | |
yield return new WaitForSecondsRealtime(delay); | |
a(); | |
} | |
protected Coroutine RunDelayed(float delay, System.Action a) | |
{ | |
return StartCoroutine(DelayedCoroutine(delay, a)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Buff : MonoBehaviour | |
{ | |
public void OnBuff() | |
{ | |
Debug.Log("buffed!"); | |
RunDelayed(2f, () => { | |
Debug.Log("debuffed!"); | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void OnBuff() | |
{ | |
Debug.Log("buffed!"); | |
RunDelayed(2f, () => { | |
Debug.Log("debuffed!"); | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"FormattingOptions": { | |
"NewLinesForBracesInLambdaExpressionBody": false, | |
"NewLinesForBracesInAnonymousMethods": false, | |
"NewLinesForBracesInAnonymousTypes": false, | |
"NewLinesForBracesInControlBlocks": false, | |
"NewLinesForBracesInTypes": false, | |
"NewLinesForBracesInMethods": false, | |
"NewLinesForBracesInProperties": false, | |
"NewLinesForBracesInObjectCollectionArrayInitializers": false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Awake() { | |
if (!Debug.isDebugBuild) { | |
Debug.Log("prod build"); | |
enabled = false; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Awake() | |
{ | |
if (!Debug.isDebugBuild) | |
{ | |
Debug.Log("prod build"); | |
enabled = false; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// mix and match | |
float y; | |
(float x, y) = GetPosition(); | |
// throw away some returned values | |
(float x, _) = GetPosition(); |