Get Unity to read in objects name without the need to hard code
- by N0xus
I'm trying to get away from having to hard code in the names of objects I want my code to use.
For example, I'm use to do it this way:
TextAsset test = new TextAsset();
test = (TextAsset)Resources.Load("test.txt", typeof(TextAsset));
What I want to know, is there a way to have so that when I drag my test.txt file onto my object in Unity, my code automatically gets the name of that object?
I'm wanting to do this so once I write the code, I don't need to back in and change it should I wish re-use it.