<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>kfcypのブログ</title>
<link>https://ameblo.jp/kfcyp/</link>
<atom:link href="https://rssblog.ameba.jp/kfcyp/rss20.xml" rel="self" type="application/rss+xml" />
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com" />
<description>ブログの説明を入力します。</description>
<language>ja</language>
<item>
<title>「ユニティちゃんでゲームを作ろう」より、Ｕｎｉｔｙ５で作ったときに躓いたところのメモ</title>
<description>
<![CDATA[ 「ユニティちゃんでゲームを作ろう」より、Ｕｎｉｔｙ５で作ったときに躓いたところのメモ<br><br><br>ｐ８４～ｐ８５のスプライトの移動と当たり判定のサンプルを作るより、<br><br><br>Ｃ＃にて記述して再生しようとすると、下記のエラーが発生した。<br><br><br>All compiler errors have to be fixed before you can enter playmode!<br><br>Assets/NewBehaviourScript.cs(ＸＸ,ＸＸ): error CS0120: An object reference is required to access non-static member `UnityEngine.Rigidbody2D.velocity'<br><br><br>※ＸＸＸ表記は環境により違う値（行，列）<br><br><br><br><br><br>■解法<br><br>原因：Ｕｎｉｔｙ<br><br>Unity5 beta までは表記コードで可能だったが、正式版より<br><br>GetComponent<br><br>が必要になるなどの記述方法が変わった。<br><br><br>そのため、下記のコードで書き直すことで解決した。<br><br><br>GetComponent<rigidbody2d>().velocity = 5 * (new Vector2 (x,y));</rigidbody2d>
]]>
</description>
<link>https://ameblo.jp/kfcyp/entry-12044259324.html</link>
<pubDate>Sun, 28 Jun 2015 21:07:37 +0900</pubDate>
</item>
</channel>
</rss>
