私の質問が重複しないことを願っています。 私は結束に問題があります。 私はオブジェクトの透過(フェードイン/フェードアウトループ)のクラスを作成しました。 シーンに2つのボタンを入れました。キャンバスの場所にあります。 実行後、私はキャンバスに透明オブジェクトのコマンドを書きましたが、内部のすべてのオブジェクトは透明になります(フェードインとフェードアウトループ)。 私は分かりません。 助けてください。団結の透明性3d
MyClassの
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System.Threading;
using System;
public class Transparent : MonoBehaviour {
private float duration = .7f;
public float waitTime;
IEnumerator co2;
// Update is called once per frame void
public void start_tranparecncy()
{
this.co2=this.blink();
this.StartCoroutine (this.co2);
}
IEnumerator blink() {
//Color textureColor = this.transform.GetComponent<SpriteRenderer>().material.color;
Color textureColor = this.transform.GetComponent<Image>().material.color;
//textureColor.a = Mathf.PingPong(Time.time, duration)/duration;
//this.GetComponent<SpriteRenderer>().material.color = textureColor;
while (true) { // this could also be a condition indicating "alive or dead"
// we scale all axis, so they will have the same value,
// so we can work with a float instead of comparing vectors
textureColor.a=Mathf.PingPong (Time.time, duration)/duration;
this.transform.transform.GetComponent<Image>().material.color = textureColor;
// reset the timer
yield return new WaitForSeconds (waitTime);
}
//end of if(this.transform.childCount =0)
}
void stop_Transparency()
{
this.StopCoroutine (this.co2);
}
}
可能であれば、コードを入力してください – Thalthanas
それは不明です。正しい命名規則を使用してください。 _command_ではなくfunctionを意味するのでしょうか? _canvas place_とは何ですか?スクリーンスペース - オーバーレイを意味しますか?内部のものは全て透明性に向いていますか?あなたが達成しようとしているものではありませんか?ユニティの透明性? – MrDos
@EmreEああ、ごめんなさい –