티스토리 뷰

Programming/Unity3D

File 읽어오기

Nine99 2010. 10. 8. 16:22
string url = "http://nine99.tistory.com/xxx.xml";

이런식의 웹데이터도 읽어올 수 있다.
또한, ogg  같은 Sound Clip  도 읽어 올 수 있음.( mp3 나 wav 는 읽어올 수 없음, unity3D 에서 지원하지 않음)



using UnityEngine;
using System.Collections; using System.Xml;
using System;

public class XXX : monoBehaviour {
string xmlString;
public IEnumerator WaitForXML()
{
yield return www;
xmlString = www.text;
print( xmlString );
}
public void TestFunction()
{
string url = "file://NoteData.xml";
www = new WWW( url );
StartCoroutine( WaitForXML() );
if ( www.error == null )
{
}
else
{
Debug.Log( "ERROR : " + www.error );
}
}

void OnGUI()
GUILayout.BeginArea( new Rect( 5, 25, 100, 400 ) ); 
//............................
if ( GUILayout.Button( "Test Button" ) )
{
TestFunction();
}
GUILayout.EndArea();
}
}
  

'Programming > Unity3D' 카테고리의 다른 글

yield 란 놈은... 참..  (0) 2010.10.13
C# Binary File Access  (0) 2010.10.11
댄스...  (0) 2010.09.20
Airplay 처음 접하고...  (0) 2010.08.27
Unity3D 에니메이션 구성성(Facial Ani 및 Eye Tracking에 관하여)  (0) 2010.08.04
댓글
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
글 보관함