From fd3fc0acdd67a57c0acb2421012e77da7d9bb2d8 Mon Sep 17 00:00:00 2001 From: Eric Levin Date: Tue, 31 Mar 2015 19:08:30 -0700 Subject: [PATCH] added unload function to lightController.js so light is deleted when it's parent entity is --- examples/entityScripts/lightController.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/entityScripts/lightController.js b/examples/entityScripts/lightController.js index e6e4998aef..31e07c4602 100644 --- a/examples/entityScripts/lightController.js +++ b/examples/entityScripts/lightController.js @@ -132,7 +132,7 @@ this.updateLightIDInUserData(); } else { var that = this; - Script.setTimeout(function() { that.maybeUpdateLightIDInUserData() }, 500); + Script.setTimeout(function() { that.maybeUpdateLightIDInUserData() }, 500); } } @@ -213,6 +213,10 @@ this.preload = function(entityID) { this.preOperation(entityID); }; + this.unload = function(){ + Entities.deleteEntity(this.lightID); + } + this.clickReleaseOnEntity = function(entityID, mouseEvent) { this.preOperation(entityID);