Coroutine not waiting for a set amount of time!

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TestCOntorller : MonoBehaviour {
public GameObject x;
private float z,c;
void Start () {

}

// Update is called once per frame
void Update () {
	StartCoroutine (kocence ());

}
IEnumerator kocence(){Debug.Log ("dadD");
	z = Random.Range (1f, 2f);

	if (z <= 1.5) {
		c = 0.3f;
	} else {
		c = 1.8f;
	}
	Instantiate (x, new Vector3 (2.93f, c, 0f),Quaternion.identity);
	yield return new WaitForSeconds(10);
	//Debug.Log ("dadD");
}}

My goal is to wait after every instantiate and not spam the screen with GameObjects .The Debug.Log does appear when i run the game “Debug.Log (“dadD”);” so the problem should be in the yield or at least i think so . I have no expiriance with coroutins thus any help willl be appriciated.

The problem is that you are starting a new coroutine in every update. What you want to do is this:

public bool spawning = false;

private void Start()
{
   StartSpawning();
}

public void StartSpawning()
{
    spawning = true;
    StartCoroutine(kocence())
}

public void StopSpawning()
{
    spawning = false;
}

IEnumerator kocence(){
    while (spawning) {
        Debug.Log ("dadD");
        z = Random.Range (1f, 2f);
        if (z <= 1.5) {
            c = 0.3f;
        } else {
            c = 1.8f;
        }
        Instantiate (x, new Vector3 (2.93f, c, 0f),Quaternion.identity);
        yield return new WaitForSeconds(10);
    }
 }