예제 #1
0
        public static Dictionary <string, FR2_Ref> FindUsageScene(GameObject[] objs, bool depth)
        {
            var dict = new Dictionary <string, FR2_Ref>();

            // var list = new List<FR2_Ref>();

            for (var i = 0; i < objs.Length; i++)
            {
                if (FR2_Unity.IsInAsset(objs[i]))
                {
                    continue;                     //only get in scene
                }

                //add selection
                if (!dict.ContainsKey(objs[i].GetInstanceID().ToString()))
                {
                    dict.Add(objs[i].GetInstanceID().ToString(), new FR2_SceneRef(0, objs[i]));
                }

                foreach (Object item in FR2_Unity.GetAllRefObjects(objs[i]))
                {
                    AppendUsageScene(dict, item);
                }

                if (depth)
                {
                    foreach (GameObject child in FR2_Unity.getAllChild(objs[i]))
                    {
                        foreach (Object item2 in FR2_Unity.GetAllRefObjects(child))
                        {
                            AppendUsageScene(dict, item2);
                        }
                    }
                }
            }

            return(dict);
        }