public void UpdateAssetAtIndex(ActorableSearchResult newResult, int index) { assetToolbarAssets[index] = newResult; toolbarItems[index].SetTexture(newResult.thumbnail); EmptyAssetToolbarRenderable(index); assetSearch.RequestRenderable(assetToolbarAssets[index].renderableReference, renderableObj => SetAssetToolbarRenderable(renderableObj, newResult, index)); }
public void SetRenderableByReference( RenderableReference renderableReference, Quaternion addlRotation, Vector3 renderableOffset, Quaternion renderableRotation, PreferredScaleFunction scaleFunction, System.Func <bool> isStillValid) { if (resultRenderable != null) { Destroy(resultRenderable); } assetSearch.RequestRenderable(renderableReference, renderableObj => { if (renderableObj == null) { return; // Just to be safe.. } // Can be called async - so we could be gone already. if (this == null || this.gameObject == null) { return; } if (isStillValid()) { renderableObj.transform.SetParent(transform); renderableObj.transform.rotation = renderableRotation * addlRotation; renderableObj.transform.localPosition = renderableOffset; renderableObj.transform.localScale = scaleFunction(renderableObj); MakeLookLikeGhost(renderableObj); if (resultRenderable != null) { Destroy(resultRenderable); } resultRenderable = renderableObj; renderableObj.SetActive(true); } else { Destroy(renderableObj); Debug.Log("renderable callback out of date"); } }); }
public void Setup( ActorableSearchResult result, Vector3 spawnPosition, Quaternion spawnRotation, Vector3 spawnScale, bool isLocal, Vector3 renderableOffset, Quaternion renderableRotation ) { // NOTE: Bit of a hack. When we're not local, 'result' only has the renderable reference set. None of the other data is relevant. this.result = result; this.spawnPosition = spawnPosition; this.spawnRotation = spawnRotation; this.spawnScale = spawnScale; this.isLocal = isLocal; this.renderableOffset = renderableOffset; this.renderableRotation = renderableRotation; assetSearch.RequestRenderable(result.renderableReference, OnRenderable); }