Tanoda
pb_MetaDataComponent.cs
Go to the documentation of this file.
1using UnityEngine;
2#if UNITY_EDITOR
3using UnityEditor;
4#endif
5using System.Collections.Generic;
6using System.Collections;
8
9namespace GILES
10{
19 [DisallowMultipleComponent]
20 [pb_JsonIgnore]
21 public class pb_MetaDataComponent : MonoBehaviour
22 {
26
30 public void SetAssetBundleData(string bundleName, string assetPath)
31 {
32 metadata.SetAssetBundleData(bundleName, assetPath);
33#if UNITY_EDITOR
34 EditorUtility.SetDirty(this);
35#endif
36 }
37
41 public bool UpdateFileId()
42 {
43 bool modified = false;
44
45#if UNITY_EDITOR
46 if( PrefabUtility.GetPrefabType(this.gameObject) == PrefabType.Prefab && metadata.assetType != AssetType.Bundle )
47 {
48 string path = AssetDatabase.GetAssetPath(this.gameObject);
49 string guid = AssetDatabase.AssetPathToGUID(path);
50
51 if( !string.IsNullOrEmpty(metadata.fileId) && !guid.Equals(metadata.fileId) )
52 {
53 Debug.Log("Level Editor: Resource fileId changed -> " + this.gameObject.name + " (" + metadata.fileId + " -> " + guid + ")");
54 modified = true;
55 }
56
57 metadata.SetFileId( guid );
58
59 EditorUtility.SetDirty(this);
60 }
61#endif
62 return modified;
63 }
64
65 public string GetFileId()
66 {
67 return metadata.fileId;
68 }
69 }
70}
UnityEngine.Debug Debug
Definition: TanodaServer.cs:19
void SetAssetBundleData(string bundleName, string assetPath)
void SetFileId(string id)
Definition: pb_MetaData.cs:100
AssetType assetType
Definition: pb_MetaData.cs:83
void SetAssetBundleData(string bundleName, string assetPath)
Definition: pb_MetaData.cs:90
AssetType
Definition: pb_Enum.cs:69