This file contains 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
/// <summary> | |
/// Performance utility code | |
/// </summary> | |
public class Utils_Perf | |
{ | |
/// <summary> | |
/// Static values with no accessor functions to slow them down. | |
/// Actually calling Vector3.zero is like calling New Vector3(0,0,0) | |
/// About 4x faster than Vector3.zero |
This file contains 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 UnityEngine; | |
using System; | |
using System.Collections; | |
using System.IO; | |
/// <summary> | |
/// | |
/// </summary> | |
public class TextureCache | |
{ |
This file contains 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.Generic; | |
//---------------------------- | |
// Some interesting shit is going on here | |
// We have a non-generic abstract base class which serves only the purpose of storing all the generic | |
// subclasses inside a common list (you'll see one in the GlobalEventSystemMaitenance class). | |
// Different events inside the EventSystem.Events namespace (and folder) are just statically typed | |
// entities used to differentiate the events one from another | |
//---------------------------- |
This file contains 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
// Let's talk about memory conservation | |
// If a Unity API returns an array, it allocates a new copy. | |
// Every time it is accessed, Even if the values do not change. | |
// Bad Sample 1: this code allocate too many Arrays | |
for ( int i = 0;i < Input.touches.Length; i++ ) // Get() accessor call + creating copy | |
{ | |
Touch touch = Input.touches[i]; // Creating copy | |
// … | |
} |