예제 #1
0
            public IEnumerator FetchAsset(MaterialWidget widget, Material target)
            {
                if (!string.IsNullOrEmpty(assetId))
                {
                    asset = Asset.AssetsManager.AddAsset(assetId);

                    if (asset != null)
                    {
                        if (asset.texture)
                        {
                            value = asset.texture;
                        }
                        else
                        {
                            asset.onProcessEnd += OnAssetUpdate;

                            if (!asset.isLoaded && !asset.texture)
                            {
                                yield return(widget.StartCoroutine(asset.LoadAssetInBackground(widget)));
                            }

                            while (!value && !asset.InProcess(Asset.Process.Error))
                            {
                                yield return(null);
                            }
                        }

                        if (value)
                        {
                            CorrectTexture(value);
                            target.SetTexture(name, value);
                        }
                    }
                }
            }
예제 #2
0
 public void Initialize(MaterialWidget material)
 {
     if (m_materialWidget != material)
     {
         m_materialWidget = material;
     }
 }
예제 #3
0
        public override void OnInstantiateAsset()
        {
            //Debug.Log(transform.CalculateBounds().ToString());
            MaterialWidget.GenerateMaterialWidgets(this);

            if (onModelInstanced != null)
            {
                onModelInstanced(this);
            }
        }
예제 #4
0
        public override void Initialize()
        {
            base.Initialize();

            var materials = MaterialWidget.GenerateMaterialWidgets(this);

            m_materialWidget = materials.FirstOrDefault();

            if (stereo)
            {
                m_secondaryMaterialWidget = materials[1];
            }
            //Initialize(m_materialWidget);
        }