Can't make coroutine work

so my script works fine without the coroutine:

using UnityEngine;
using System.Collections;

public class jointbreak : MonoBehaviour 
{

	private ParticleRenderer myParticleRender;
	private ParticleEmitter myParticleEmitter;

	void Start ()
	{
		myParticleRender = GetComponent<ParticleRenderer>();
		myParticleEmitter = GetComponent<ParticleEmitter>();
	}

	Void OnJointBreak(float breakForce)
	{
		myParticleRender.enabled = true;
		myParticleEmitter.enabled = true;
	}
}

But unfortunately I need a delay after enabling to disable the particles again, and this is my script now:

using UnityEngine;
using System.Collections;

public class jointbreak : MonoBehaviour 
{

	private ParticleRenderer myParticleRender;
	private ParticleEmitter myParticleEmitter;

	void Start ()
	{
		StartCoroutine(OnJointBreak(float breakForce));
		myParticleRender = GetComponent<ParticleRenderer>();
		myParticleEmitter = GetComponent<ParticleEmitter>();
	}

	IEnumerator OnJointBreak(float breakForce)
	{
		myParticleRender.enabled = true;
		myParticleEmitter.enabled = true;
		yield return new WaitForSeconds(10.0f);
		myParticleRender.enabled = false;
		myParticleEmitter.enabled = false;
	}
}

It looks like there is some issue in …(OnJointBreak(float breakForce));… right after float XD any idea?

You are starting the coroutine before you are initializing ‘myParticleRenderer’ and ‘myParticleEmitter’. Take line 12, and move it down below line 14 and your code should work.

Instead of:

 StartCoroutine(OnJointBreak(float breakForce));

Use:

 float breakForce = 5.0f;
 StartCoroutine(OnJointBreak(breakForce));

With whatever value of breakForce is appropriate.

The issue is that instead of passing a value to the OnJointBreak function you are declaring a new variable.