So I’m trying to get the file path of an asset. I’ve done so in a previous project and it works then, but not in my current project. Any ideas?
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using System.Text.RegularExpressions;
using UnityStandardAssets.CrossPlatformInput;
using UnityEngine.SceneManagement;
public class ResourcesTest : MonoBehaviour {
public GameObject[ ] list;
public List AssetPaths;
public GameObject test;
// Use this for initialization
void Start () {
//list = GameObject.FindObjectsOfType (typeof(MeshFilter));
list = GameObject.FindGameObjectsWithTag(“Finish”);
for (int i = 0; i < list.Length; i++) {
// Debug.Log (list*);*
//AssetPaths.Add(AssetDatabase.GetAssetPath(list*));*
AssetPaths.Add(AssetDatabase.GetAssetPath(list*.GetComponent().mesh));*
Debug.Log (AssetPaths );
//Debug.Log (AssetDatabase.GetAssetPath(list*));*
}
Debug.Log (AssetDatabase.GetAssetPath (test.GetComponent().mesh));
Debug.Log (test.GetComponent ().mesh);
}
// Update is called once per frame
void Update () {
}
}
2932353–216875–ResourcesTest.cs (1.02 KB)