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); } } } }
public void Initialize(MaterialWidget material) { if (m_materialWidget != material) { m_materialWidget = material; } }
public override void OnInstantiateAsset() { //Debug.Log(transform.CalculateBounds().ToString()); MaterialWidget.GenerateMaterialWidgets(this); if (onModelInstanced != null) { onModelInstanced(this); } }
public override void Initialize() { base.Initialize(); var materials = MaterialWidget.GenerateMaterialWidgets(this); m_materialWidget = materials.FirstOrDefault(); if (stereo) { m_secondaryMaterialWidget = materials[1]; } //Initialize(m_materialWidget); }