I want to get a path of sprite using the spriteRenderer component in Unity.I want my path should be like - "asset/PATH OF MY FILE/FILENAME.EXTENSION". Currently I am using following code but it returns only parent name/path.
string GetSpritePath(Transform goPath){ List<string> path = new List<string> (); Transform current = goPath.transform; path.Add(current.name); while (current.parent != null) { path.Insert(0, current.parent.name); current = current.parent; } return string.Join("/", path.ToArray()); } Whats wrong with my code ?