Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
splines from .txt files
#5
Hey, thanks for the pointers.
I am learning about Editor scripting as fast as I can. It seems the most useful aspect of working in Unity.
It still doesn't work, but here is my new attempt:

My idea so far is to drop the custom editor on a prefab of a CurvySplineSegment, then drop a text file into it, click READ and automate adding a CurvySpline control point for each line. I hope I am going about this the right way. I shall keep doing research.

Heres the script, and advice or tips or direction would very welcome:

[font]using UnityEngine;
using UnityEditor;
using System.Collections;


[CustomEditortypeofsplineReader ) )]
public class splineReader : Editor
{

    public TextAsset track;
    string fileRead = track.text;

    public override void OnInspectorGUI()

    {

        base.OnInspectorGUI ();

        EditorGUILayout.LabelField ("Spine Reader");

        ifGUILayout.Button ( "READ!"))
        {
            Debug.Log("pressed read");

            string lines = fileRead.Split("\n")

            while (lines != null)
            {
            
                string[] position = fileRead.Split (" ");
        
                CurvySpline.Add(new vector3 ([0],[1],[2]))

                Debug.Log("made a CP")

                string lines = fileRead.Split ("\n");

            }

            Debug.Log("done making a spline")

        }
                
                
    }            



}[/font]




i found these tutorials the most helpful ~

building a custom editor:
https://www.youtube.com/watch?v=WlGwBmM-dfA
Reading text files into strings (also awesome accent hehe):
https://www.youtube.com/watch?v=4hnItE2gZ40
 
Reply


Messages In This Thread
splines from .txt files - by Lila - 04-30-2014, 01:18 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Information New free asset: Converter For Unity Splines _Aka_ 5 18 04-25-2024, 11:11 AM
Last Post: _Aka_
  snap to the curve created by the curvy splines segment points ShiroeYamamoto 3 11 04-02-2024, 02:24 PM
Last Post: _Aka_
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_
  Using Unity's SplineContainer in Curvy Splines dlees9191 3 15 02-26-2024, 09:49 AM
Last Post: _Aka_

Forum Jump: