This question was
closed Jul 25, 2017 at 07:02 AM by
etopsirhc for the following reason:
The question is answered, right answer was accepted
is there a way to get the name of a non-instantiated prefab?
so what i'm doing is trying to make a dictonary of prefabs using Resources.LoadAll("Particles/", typeof(GameObject)) as GameObject[];
but i need to get the name of each loaded GameObject in the array.
i've tried both the .name;
and .ToString();
but both require it to be an instance of the GameObject.
Comment
Best Answer
Answer by Bunny83 · Jul 23, 2017 at 03:54 AM
.name should work just fine. You haven't included an example otherwise we could tell you what went wrong.
GameObject[] prefabs = Resources.LoadAll<GameObject>("Particles/");
foreach(var p in prefabs)
{
Debug.Log("Prefab object name: " + p.name)
}
i dont understand it, i was getting the "not an instance of a GameObject" before, but now it's actually working -pulls what little hair i have left out-