Skip to content

Instantly share code, notes, and snippets.

@ikoan310
Created November 12, 2018 06:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ikoan310/c778b03f9501362d441e35532b00f8e3 to your computer and use it in GitHub Desktop.
Save ikoan310/c778b03f9501362d441e35532b00f8e3 to your computer and use it in GitHub Desktop.
Create ScriptableObject Example
void Sample()
{
string[] csv = File.ReadAllLines("PATH");
// read line
for(int n=0 ; n<csv.Length ; n++)
{
// create scriptable object
SampleScriptableObject scObject = CreateInstance<SampleScriptableObject>();
string[] datas = csv[n].Split(',');
scObject.hoge = int.Parse(datas[0]);
// save scriptable object
AssetDatabase.CreateAsset(scObject, "<Path>.asset");
AssetDatabase.Refresh();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment