Ejemplo n.º 1
0
    void UpdateAsset(ActorableSearchResult result)
    {
        this.result = result;
        ActorableSearchResult tempResult = result;

        createToolPreview.SetRenderableByReference(
            result.renderableReference,
            GetAdditionalRotation(),
            result.GetRenderableOffset(),
            result.preferredRotation,
            result.preferredScaleFunction,
            () => { return(tempResult.renderableReference.uri == this.result.renderableReference.uri); });
    }
Ejemplo n.º 2
0
    void SetCreatePreviewSettingsJson(string createPreviewSettingsJson)
    {
        if (lastCreatePreviewSettingsJson == createPreviewSettingsJson)
        {
            return;
        }

        lastCreatePreviewSettingsJson = createPreviewSettingsJson;
        if (createPreviewSettingsJson.IsNullOrEmpty())
        {
            if (createPreviewInst != null)
            {
                GameObject.Destroy(createPreviewInst.gameObject);
                createPreviewInst = null;
            }
        }
        else
        {
            // Settings changed, create new preview
            var settings = JsonUtility.FromJson <CreatePreviewSettings>(createPreviewSettingsJson);

            if (createPreviewInst != null)
            {
                GameObject.Destroy(createPreviewInst.gameObject);
            }

            createPreviewInst = Instantiate(createPreviewPrefab);
            createPreviewInst.SetRenderableByReference(
                settings.renderable,
                settings.addlRotation,
                settings.renderableOffset,
                settings.renderableRotation,
                _ => settings.scale,
                () => true);

            createPreviewInst.SetTint(currentTint);
        }
    }