how to attach a controller script at runtime