Check out example codes for "unity buoncy changing". It will help you in understanding the concepts better.

Code Example 1

void Start()
    {
      StartCoroutine("coRoutineTest", 1f);   
    }


IEnumerator coRoutineTest (float waitTIme)
    {
        while (true)
        {
            

            buoyancy.surfaceLevel = Random.Range(4f, 2f);

            yield return new WaitForSeconds(waitTIme);
        }
    }

Learn ReactJs, React Native from akashmittal.com