Skip to content

Commit

Permalink
Change how Futile force the GC to run
Browse files Browse the repository at this point in the history
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();
  • Loading branch information
MattRix committed Jun 15, 2013
1 parent 78cf15f commit 3500250
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions FutileProject/Assets/Futile/Futile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -313,9 +313,9 @@ private void Update()

_isDepthChangeNeeded = false;

if(shouldRunGCNextUpdate)
if(_shouldRunGCNextUpdate)
{
shouldRunGCNextUpdate = false;
_shouldRunGCNextUpdate = false;
GC.Collect();
}
}
Expand Down Expand Up @@ -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
{
Expand Down

0 comments on commit 3500250

Please sign in to comment.