Version: 5.3 (switch to 5.4b)
言語English
  • C#
  • JS

スクリプト言語

好きな言語を選択してください。選択した言語でスクリプトコードが表示されます。

Renderer.enabled

マニュアルに切り替える
public bool enabled;

説明

有効にした場合、レンダリングされた 3D オブジェクトが表示されます

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Renderer rend; void Start() { rend = GetComponent<Renderer>(); rend.enabled = true; }

// Toggle the Object's visibility each second. void Update() { // Find out whether current second is odd or even bool oddeven = Mathf.FloorToInt(Time.time) % 2 == 0; // Enable renderer accordingly rend.enabled = oddeven; } }