From 3500250513f600d2ff326d12fb046d9b56c3fdd9 Mon Sep 17 00:00:00 2001 From: Matt Rix Date: Sat, 15 Jun 2013 12:53:58 -0400 Subject: [PATCH] Change how Futile force the GC to run The old approach made a public property appear in the hierarchy view, which didn't really make any sense. Now you can just call Futile.instance.ForceGarbageCollectionNextUpdate(); --- FutileProject/Assets/Futile/Futile.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/FutileProject/Assets/Futile/Futile.cs b/FutileProject/Assets/Futile/Futile.cs index b5c4d08..9bd393d 100644 --- a/FutileProject/Assets/Futile/Futile.cs +++ b/FutileProject/Assets/Futile/Futile.cs @@ -56,12 +56,12 @@ public class Futile : MonoBehaviour public event FutileUpdateDelegate SignalLateUpdate; //configuration values - public bool shouldRunGCNextUpdate = false; public bool shouldTrackNodesInRXProfiler = true; private GameObject _cameraHolder; private Camera _camera; - + + private bool _shouldRunGCNextUpdate = false; //use Futile.instance.ForceGarbageCollectionNextUpdate(); private FutileParams _futileParams; @@ -313,9 +313,9 @@ private void Update() _isDepthChangeNeeded = false; - if(shouldRunGCNextUpdate) + if(_shouldRunGCNextUpdate) { - shouldRunGCNextUpdate = false; + _shouldRunGCNextUpdate = false; GC.Collect(); } } @@ -356,6 +356,11 @@ public void UpdateCameraPosition() _camera.transform.position = new Vector3(camXOffset, camYOffset, -10.0f); } + + public void ForceGarbageCollectionNextUpdate() + { + _shouldRunGCNextUpdate = true; + } new public Camera camera {