MyCanvas.SetActive C# (CSharp) Method

SetActive() public static method

public static SetActive ( string name, bool b ) : void
name string
b bool
return void
    public static void SetActive(string name, bool b)
    {
        foreach (Transform child in _canvas.transform)
        {
            // 子の要素をたどる
            if (child.name == name)
            {
                // 指定した名前と一致
                // 表示フラグを設定
                child.gameObject.SetActive(b);
                // おしまい
                return;
            }
        }
        // 指定したオブジェクト名が見つからなかった
        Debug.LogWarning("Not found objname:" + name);
    }
}

Usage Example

コード例 #1
0
ファイル: MyButton.cs プロジェクト: tokiacmilan/HandFlight
    public void OnClick()
    {
        Debug.Log("Button click!");
        gameObject.SetActive(false);

        MyCanvas.SetActive("Button2", true);
    }
All Usage Examples Of MyCanvas::SetActive