- Home /
Question by
$$anonymous$$ · Dec 28, 2016 at 02:10 PM ·
c#objecteditor-scriptingpath
How to retrieve the asset path from inside a component
Hello, I'm trying to retrieve the path of an asset in my project from inside a component. I need the string to then write on another file but that isn't important now.
Specifically I'm trying to get the path of a mesh from MeshFilter component, I have been using AssetDatabase.GetAssetPath(), it return an empty string, tried also GetInstanceID() and same result, this is part of hte code:
MeshFilter[] _filter = _geometry.GetComponentsInChildren<MeshFilter> ();
for(int i = 0; i < _filter.Length; i++)
{
Debug.Log (AssetDatabase.GetAssetPath (_filter[i].sharedMesh.GetInstanceID()));
}
Anyone know if is possible to retrieve the path of the object in other ways? Thanks.
Comment
Your answer
Follow this Question
Related Questions
Unity API for checking if an object was modified 3 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Syntax for EditorApplication.playmodeStateChanged 1 Answer
Trouble grabbing and holding a cube. 0 Answers