Exemplo n.º 1
0
            void LoadFromGuid()
            {
                string guid = m_Guid;
                var    pw   = ComponentList.GetFirst <ProxyWorld>();

                m_Ob    = pw.FindGameObjectWithGuid(guid);
                m_Proxy = pw.FindProxyWithGuid(guid);
            }
Exemplo n.º 2
0
        private void Start()
        {
            // Try to guess the proxy based on our name.  Sloppy but most of the time this feature is not used because we manually call PostInstantiate (it's mostly for testing)
            var pworld = ComponentList.GetFirst <ProxyWorld>();

            if (pworld != null)
            {
                string myName        = gameObject.name.ToLower();
                int    myParenthesis = myName.IndexOf('(');
                if (myParenthesis >= 0)
                {
                    myName = myName.Substring(0, myParenthesis);
                }

                bool found = false;
                foreach (var entry in pworld.m_Objects)
                {
                    if (entry == null)
                    {
                        continue;
                    }
                    if (entry.gameObject == null || entry.gameObject.name == null)
                    {
                        Debug.Log("Bad gameobject found in proxy world objects list\n");
                    }
                    var entryName = entry.gameObject.name.ToLower();

                    if (myName == entryName)
                    {
                        Prefab = entry;
                        found  = true;
                        break;
                    }
                }
                if (!found)
                {
                    Debug.LogError("Proxied missing: " + gameObject.name);
                }
            }

            VirtualStart();
        }