# Bubbles II
**Application**: VFX
![[DESIGNS/TOYS/ObjectClicker__Attracts_and_transforms_objects.gif]]
## Code
#### Scene Controller
```cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using static TMPro.Examples.TMP_ExampleScript_01;
public class ObjClicker_Controller_II : MonoBehaviour
{
List<GameObject> objectsList = new List<GameObject>();
public Color[] colorArr;
public GameObject objPref;
private float xBorder = 9;
private float yBorder = 5;
public void CreateObj_OnB()
{
for (int i = 0; i < 10; i++) InstantiateOneObj();
}
private void InstantiateOneObj()
{
Vector3 objPos = new Vector3(Random.Range(-xBorder, xBorder),
Random.Range(-yBorder, yBorder), 0);
int colorIndex = Random.Range(0, colorArr.Length);
GameObject newObj = Instantiate(objPref, objPos, Quaternion.identity);
newObj.GetComponent<SpriteRenderer>().color = colorArr[colorIndex];
// Add to the list
objectsList.Add(newObj);
}
public void ShowList()
{
foreach (GameObject obj in objectsList) Debug.Log(obj.name);
}
public void MoveObjects()
{
foreach (GameObject obj in objectsList)
{
Debug.Log(obj.name);
ObjClicker_Mover_II objScript = obj.GetComponent<ObjClicker_Mover_II>();
objScript.ChangeBool();
}
}
}
```
#### Clicker
The script is attached to the blue circle
```cs
public class ObjClicker_Centre_II : MonoBehaviour
{
public GameObject controller;
private void OnMouseDown()
{
ConnectToController();
}
private void ConnectToController()
{
ObjClicker_Controller_II contrScript = controller.GetComponent<ObjClicker_Controller_II>();
contrScript.MoveObjects();
}
}
```