Common Lodash Functions and Their Native JavaScript Alternatives
Iterating a Specific Number of Times
JavaScript's for loop is standard for iteration, but Lodash's _.times offers a concise alternative for fixed counts.
// Native JavaScript
for (let i = 0; i < 5; i++) {
console.log(i);
}
// Lodash
_.times(5, (index) => {
console.log(index);
});
Accessing Nested Porperties
Lodash's _.map allows ...
Posted on Sun, 17 May 2026 18:52:06 +0000 by zander213
Essential Utility Functions for Unity Projects
Cached Camera Reference
Accessing Camera.main repeatedly incurs a performance cost because Unity perfomrs a scene-wide search by tag each time. To avoid this, maintain a single cached reference initialized on first access:
private static Camera _cachedMainCamera;
public static Camera MainCamera
{
get
{
if (_cachedMainCamera == ...
Posted on Sun, 10 May 2026 00:24:53 +0000 by noobcody