http://japan.unity3d.com/developer/document/tutorial/my-first-unity/01.html
こちらのUnityのチュートリアルを試していて、まったく同じように作り上げましたが、
・ラケットを操作可能にしよう
のスクリプトを入力したところ、Unity上でソースが変更され、さらにそれを実行するとオブジェクトは動きますが、エラーコードが延々と出力され続けます。
(updateを実行するたびにエラーが吐かれている模様)
エラー内容です。
MissingComponentException: There is no 'Rigidbody' attached to the "Cube (4)" game object, but a script is trying to access it.
You probably need to add a Rigidbody to the game object "Cube (4)". Or your script needs to check if the component is attached before using it.
UnityEngine.Rigidbody.AddForce (Vector3 force, ForceMode mode) (at C:/buildslave/unity/build/artifacts/generated/common/modules/NewDynamicsBindings.gen.cs:700)
RacketController.Update () (at Assets/RacketController.js:9)
一応説明ですが、Cube(4)はラケットのオブジェクトになります。
以下スクリプトです。
lang
1#pragma strict 2var Accel = 1000.0; 3function Start () { 4 5}; 6 7function Update () { 8GetComponent.<Rigidbody>().AddForce( 9 transform.right * Input.GetAxisRaw( "Horizontal" ) * Accel, 10 ForceMode.Impulse 11 ); 12}
どなたかUnityに詳しい方お願いします。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。