Пример #1
0
    public override void OnInspectorGUI()
    {
        rail = target as RailCreator;

        DrawPointsInspector();

        //ポイントを追加
        if (GUILayout.Button("Add Rail"))
        {
            Undo.RecordObject(rail, "Add Rail");
            rail.AddPoint();
            EditorUtility.SetDirty(rail);
        }
        EditorGUILayout.Space();
        EditorGUILayout.Space();

        rail.createObject = EditorGUILayout.ObjectField("Rail Object", rail.createObject, typeof(GameObject), false) as GameObject;

        GUILayout.Label("Railの名前");
        rail.railName = EditorGUILayout.TextField("Rail Name", rail.railName);

        GUILayout.Label("GenerateはUndo出来ません");
        if (GUILayout.Button("Generate"))
        {
            rail.Generate();
        }
    }
Пример #2
0
    private void OnSceneGUI()
    {
        rail = target as RailCreator;

        //線を描画
        for (int i = 0; i < rail.points.Length - 1; i++)
        {
            Vector3 p0 = ShowPoint(i);
            Vector3 p1 = ShowPoint(i + 1);

            Handles.color = lineColor;
            Handles.DrawLine(p0, p1);
        }
    }