05-22-2014, 04:12 AM
Thank you, good to know about 1.61 and the related bugs. Does this mean a new version is coming out soon?
I have slightly changed directions again. I am a beginner at code, so the learning curve is a bit steep.
This works to read and put the data into strings:
VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
[font]using UnityEngine;
using System.Collections;
public class readTXT : MonoBehaviour {
public TextAsset track;
void Start()
{
string[] dataLines = track.text.Split('\n');
string[][] dataPoints = new string[dataLines.Length][];
int lineNum = 0;
foreach (string line in dataLines)
{
dataPoints[lineNum++] = line.Split(' ');
}
//DEBUGGING: (it works)
//Debug.Log(track.text); //print document
//Debug.Log(dataPoints[2][1]); // prints 10.65696526
//Debug.Log(dataLines[5]); // prints -27.31221962 11.09237289 76.1122818
}
}
And this works just to reference this script and make a button:
VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
using UnityEngine;
using UnityEditor;
using System.Collections;
[CustomEditor( typeof( readTXT ) )]
public class Read : Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI ();
EditorGUILayout.LabelField ( "Spine Reader" );
if( GUILayout.Button ( "READ!"))
{
Debug.Log( "pressed read" );
}
}
}
But as far as getting it to read the file into a spline, I am not sure. When I try I get errors for trying to access a non static variable. But really, I am not sure how to address curvy. Should I make an array of vector3? Or a for / foreach look to cycle through the document and instantiate a control point?
I looked at the information on SplineShaper and CurvyShape, but I am afraid as a beginner I wasn't able to glean much from them.
Does this mean CurvySpline.Add() is not the right way to make a control point?[/font]
I have slightly changed directions again. I am a beginner at code, so the learning curve is a bit steep.
This works to read and put the data into strings:
VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
[font]using UnityEngine;
using System.Collections;
public class readTXT : MonoBehaviour {
public TextAsset track;
void Start()
{
string[] dataLines = track.text.Split('\n');
string[][] dataPoints = new string[dataLines.Length][];
int lineNum = 0;
foreach (string line in dataLines)
{
dataPoints[lineNum++] = line.Split(' ');
}
//DEBUGGING: (it works)
//Debug.Log(track.text); //print document
//Debug.Log(dataPoints[2][1]); // prints 10.65696526
//Debug.Log(dataLines[5]); // prints -27.31221962 11.09237289 76.1122818
}
}
And this works just to reference this script and make a button:
VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
using UnityEngine;
using UnityEditor;
using System.Collections;
[CustomEditor( typeof( readTXT ) )]
public class Read : Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI ();
EditorGUILayout.LabelField ( "Spine Reader" );
if( GUILayout.Button ( "READ!"))
{
Debug.Log( "pressed read" );
}
}
}
But as far as getting it to read the file into a spline, I am not sure. When I try I get errors for trying to access a non static variable. But really, I am not sure how to address curvy. Should I make an array of vector3? Or a for / foreach look to cycle through the document and instantiate a control point?
I looked at the information on SplineShaper and CurvyShape, but I am afraid as a beginner I wasn't able to glean much from them.
Does this mean CurvySpline.Add() is not the right way to make a control point?[/font]