Unityな日々(Unity Geek)

Unityで可視化アプリを開発するための試行錯誤の覚書

2012-12-08から1日間の記事一覧

他のGameObject、Componentにアクセスする

現在のScriptがアタッチされているGameObject以外のGameObjectにアクセするには次の方法がある。 1)Inspectorでアサインする public変数としてGameObjectを定義し、Inspector上で該当GameObjectをアサインする方法。 簡単だが、この方法だとScriptだけで完…

同階層のComponentにアクセスする

Componentとは、GameObjectに付加する部品のようなもの。一般的には、GetComponent("Component名") で取得する。javascript GetComponent(Transform).Translate(0, 1, 0);C# using UnityEngine; using System.Collections; public class example : MonoBehav…