creating instances

I want to create my own classes and instantiate like normal OOP code.

I tried using

line = ScriptableObject.CreateInstance(PathMaker);

93[ScriptableObject.CreateInstance() ][1]93 but this gave:

Instance of PathMaker couldn't be created.
The the script class needs to derive from ScriptableObject.

how should i do that from javascript?

my class looks something like the below. its just to draw lines on screen, but i need a lot of instances of these paths with their own points.

// Creates a line renderer for path of objects

var c1 : Color = Color.yellow;
var c2 : Color =;
var path: Array;
var lineRenderer: LineRenderer;

function Start() {
     lineRenderer = gameObject.AddComponent(LineRenderer);
     lineRenderer.material = new Material (Shader.Find("Particles/Additive"));
     lineRenderer.SetColors(c1, c2);
	 var points = [Vector3( 0,0,0), 		

public function setPath(pointList: Array) {
	path = pointList;

public function addPoint(pt: Vector3) {

function setPointCount() {

function Update() {
    var lineRenderer : LineRenderer = GetComponent(LineRenderer);
    for(var i : int = 0; i < path.length; i++) {
        var pos: Vector3 = path*;*

lineRenderer.SetPosition(i, pos);

You need to use OOP and extend ScriptableObject.

class PathMaker extends ScriptableObject {
  // my code