//対象と線の開始位置お終了位置を指定してLineRendererを生成
    private static ColliderRenedrer CreateLineRenderer(Collider2D target, Vector3 startPoint, Vector3 endPoint, bool isTrigger)
    {
        if (_lineRendererMaterial == null)
        {
            _lineRendererMaterial = Resources.Load <Material>("ColliderRenedrerMaterial");
        }

        //対象の子にオブジェクトを生成し、そこにColliderRenedrerを作成
        GameObject renedrerObject = new GameObject("ColliderRenedrer");

        renedrerObject.transform.SetParent(target.transform);
        ColliderRenedrer colliderRenedrer = renedrerObject.AddComponent <ColliderRenedrer>();

        //ColliderRenedrerと同じオブジェクトにLineRendererを作成
        LineRenderer lineRenderer = colliderRenedrer.gameObject.AddComponent <LineRenderer>();

        //レイヤーとマテリアル設定
        //lineRenderer.sortingLayerName = ""; //レイヤーを指定
        lineRenderer.sortingOrder   = 100;
        lineRenderer.sharedMaterial = _lineRendererMaterial;

        //対象が動いたらLineRendererも動くように
        lineRenderer.useWorldSpace = false;

        //線の太さ
        lineRenderer.SetWidth(0.01f, 0.01f);

        //線の色
        Color lineColor = isTrigger ? Color.green : Color.red;

        lineRenderer.SetColors(lineColor, lineColor);

        //頂点を設定
        lineRenderer.SetVertexCount(2);
        lineRenderer.SetPosition(0, startPoint);
        lineRenderer.SetPosition(1, endPoint);

        //ColliderRenedrerにレンダラーとコライダーを設定し、返す
        colliderRenedrer.Init(lineRenderer, target);
        return(colliderRenedrer);
    }
    //=================================================================================
    //全LineRendererの生成、削除
    //=================================================================================

    /// <summary>
    /// Collider2dを可視化するためのLineRendererを作成
    /// </summary>
    public static void CreateLineRenderer()
    {
        //全Collider2Dを取得し、コライダーに合わせてLineRendrerを生成
        foreach (BoxCollider2D boxCollider2D in Object.FindObjectsOfType <BoxCollider2D>())
        {
            _colliderRenedrerList.AddRange(ColliderRenedrer.CreateLineRenderer(boxCollider2D));
        }
        foreach (EdgeCollider2D edgeCollider2D in Object.FindObjectsOfType <EdgeCollider2D>())
        {
            _colliderRenedrerList.AddRange(ColliderRenedrer.CreateLineRenderer(edgeCollider2D));
        }
        foreach (PolygonCollider2D polygonCollider2D in Object.FindObjectsOfType <PolygonCollider2D>())
        {
            _colliderRenedrerList.AddRange(ColliderRenedrer.CreateLineRenderer(polygonCollider2D));
        }
        foreach (CircleCollider2D circleCollider2D in Object.FindObjectsOfType <CircleCollider2D>())
        {
            _colliderRenedrerList.AddRange(ColliderRenedrer.CreateLineRenderer(circleCollider2D));
        }

        //生成したColliderRenedrerの表示を更新
        IsEnabled = _isEnabled;
    }