highfidelity/hifi — pull request #3855 by ZappoMan (2014-11-22 19:56:07+00:00)
Title: fix bugs in unloading scripts when changing domains

The sit script depends in the unload() method being called to properly cleanup. We weren't calling this on changing of domains. This caused the following error messages if you changed domains while sitting.

```
[DEBUG] [11/20 20:41:16] Uncaught exception at ( "Entities" ) line 237 : "TypeError: Result of expression 'this.removeIndicators' [undefined] is not a function."
```

There were other side effects as well like potentially leaving scripts running and/or overlays on screen.

We now call the unload for any active scripts when we "clear" the entity renderer.