- Home /
Question by
Sprite101 · Mar 13, 2012 at 12:15 AM ·
assetdatabasetextassetcsv
UnityEngine.DefautAsset as TextAsset
I'm trying to load a CSV file using a relative reference as a TextAsset.
dataBase = AssetDatabase.LoadMainAssetAtPath("Assets/Game Specific Assets/GameData/weapons.csv") as TextAsset;
But I get an invalid cast exception. I can find no reference to UnityEngine.DefaultAsset anywhere and I'm not sure what I'm doing wrong.
Comment
What's the type of dataBase
? What specific error message are you getting?
Its a TextAsset, but I found a good workaround here:
http://answers.unity3d.com/questions/193735/automatic-csv-to-txt-conversion-solved.html
Answer by Sprite101 · Mar 13, 2012 at 04:25 AM
Its a TextAsset, but I found a good work around here:
http://answers.unity3d.com/questions/193735/automatic-csv-to-txt-conversion-solved.html
Your answer
![](https://koobas.hobune.stream/wayback/20220613065042im_/https://answers.unity.com/themes/thub/images/avi.jpg)