Lightning effect

I have searched for this and I was not successful.

Has anybody made a lightning / electric arc effect, using assets and/or scripting?

Some time ago I made a “electro shock weapon” effect which worked like this : It was basically a rectangle with the Particles/Additive shader and a “lighting” texture which changed randomly. The texture looked like this :

The rectangle actually showed only 1/8 of the texture, it’s x offset changed randomly with the following script :

var mfMinInterval : float;
var mfMaxInterval : float;
var mvOffset = Vector2( 0.125, 0.0 );

private var mfTimer = 0.0;

function Update () 
{
	mfTimer -= Time.deltaTime;
	if( mfTimer <= 0.0 )
	{
		mfTimer = Random.Range( mfMinInterval, mfMaxInterval );
		renderer.material.mainTextureOffset += mvOffset;
	}
}

where mfMinInterval and mfMaxInterval define the minimal and maximal delay between texture changes.

To find tutorials on how to create the lighning bolts, search “lightning photoshop” in Google.

http://forum.unity3d.com/threads/77905-Zapper-lightning-project?highlight=spark

There’s was whole contest with lots of very good results:
http://forum.unity3d.com/threads/73453-Fabricator-Contest-New-Prefab-amp-New-Prize!

Or go directly to the website:
http://musegames.com/contest

It has many excellent effects where you can pick the one that suits your purposes best.

Wow, this is really great

Thank you all, I hope to use this solutions soon

I’ve spent a lot of time developing this lightning asset: Unity Asset Store - The Best Assets for Game Making

It’s highly optimized and procedural, and all the animation is done on the GPU.