private static void AddReference(AssetData assetData, Object obj, bool isSceneObject)
        {
            var guid = AssetDatabase.AssetPathToGUID (AssetDatabase.GetAssetPath (obj));
            if (string.IsNullOrEmpty (guid))
                return;

            if (isSceneObject) {
                Transform transform = null;

                var go = obj as GameObject;

                if (go)
                    transform = go.transform;
                else {
                    //                        var component = o as Component;
                    //                        if (component)
                    //                            transform = component.transform;
                }

                if (transform == null)
                    return;

                assetData.sceneData.Add (new SceneData
                {
                    guid = guid,
                    name = GetPathName(transform),
                    typeName = obj.GetType().FullName
                });
            } else {
                if (string.IsNullOrEmpty (guid))
                    return;

                if (AssetDatabase.IsSubAsset (obj)) {
                    var sub = new SubAssetData
                    {
                        name = obj.name,
                        guid = guid,
                        typeName = obj.GetType().FullName
                    };
                    if (assetData.subAssets.Count (s => s.guid == sub.guid && s.name == sub.name && s.typeName == sub.typeName) == 0) {
                        assetData.subAssets.Add (sub);
                    }
                } else {
                    if (assetData.reference.Contains (guid) == false)
                        assetData.reference.Add (guid);
                }
            }
        }
예제 #2
0
        protected void AddSubAssetReference(Object obj)
        {
            var guid = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(obj));

            if (string.IsNullOrEmpty(guid) || AssetDatabase.IsSubAsset(obj) == false)
            {
                return;
            }


            var sub = new SubAssetData
            {
                name     = obj.name,
                guid     = guid,
                typeName = obj.GetType().FullName
            };

            if (subAssets.Count(s => s.guid == sub.guid && s.name == sub.name &&
                                s.typeName == sub.typeName) == 0)
            {
                subAssets.Add(sub);
            }
        }
예제 #3
0
        private static void AddReference(AssetData assetData, Object obj, bool isSceneObject)
        {
            var guid = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(obj));
            if (string.IsNullOrEmpty(guid))
                return;

            if (isSceneObject)
            {
                Transform transform = null;

                var go = obj as GameObject;

                if (go)
                    transform = go.transform;
                else
                {
                    //                        var component = o as Component;
                    //                        if (component)
                    //                            transform = component.transform;
                }

                if (transform == null)
                    return;

                assetData.sceneData.Add(new SceneData
                {
                    guid = guid,
                    name = GetPathName(transform),
                    typeName = obj.GetType().FullName
                });
            }
            else
            {
                if (string.IsNullOrEmpty(guid))
                    return;

                if (AssetDatabase.IsSubAsset(obj))
                {
                    var sub = new SubAssetData
                    {
                        name = obj.name,
                        guid = guid,
                        typeName = obj.GetType().FullName
                    };
                    if (assetData.subAssets.Count(s => s.guid == sub.guid && s.name == sub.name && s.typeName == sub.typeName) == 0)
                    {
                        assetData.subAssets.Add(sub);
                    }
                }
                else
                {
                    if (assetData.reference.Contains(guid) == false)
                        assetData.reference.Add(guid);
                }
            }
        }