Set $scripts variable for layout in AppController and SpecificController

I tried to set universal scripts in beforeRender of AppController only if specific scripts are not set in $this->viewVars. But it still shows only universal scripts.