Exemplo n.º 1
0
        public static void ToAssetByGUID <T>(this string data, ref T val) where T : UnityEngine.Object
        {
            var ass = UnityHelperFunctions.GUIDtoAsset <T>(data);

            if (ass)
            {
                val = ass;
            }
        }
Exemplo n.º 2
0
        public bool Inspect <T>(ref T field) where T : UnityEngine.Object
        {
            bool changed = name.edit(100, ref field);

#if UNITY_EDITOR
            if (guid != null && icon.Search.Click("Find Object " + componentType + " by guid").nl())
            {
                var obj = UnityHelperFunctions.GUIDtoAsset <T>(guid);

                if (obj)
                {
                    field = obj;

                    if (componentType != null && componentType.Length > 0)
                    {
                        var go = obj as GameObject;
                        if (go)
                        {
                            var getScripts = go.GetComponent(componentType) as T;
                            if (getScripts)
                            {
                                field = getScripts;
                            }
                        }
                    }

                    changed = true;
                }
                else
                {
                    (typeof(T).ToString() + " Not found ").showNotification();
                }
            }
#endif


            return(changed);
        }