{"id":1773,"date":"2022-07-03T13:22:14","date_gmt":"2022-07-03T04:22:14","guid":{"rendered":"https:\/\/dalomo.net\/blog\/?p=1773"},"modified":"2022-09-19T10:53:24","modified_gmt":"2022-09-19T01:53:24","slug":"%e3%80%8e%e6%9d%b1%e4%ba%ac%e3%83%91%e3%82%bd%e3%82%b3%e3%83%b3%e3%82%af%e3%83%a9%e3%83%96%e3%80%8f%e3%81%a7%e3%82%a2%e3%82%a4%e3%83%89%e3%83%ab%e3%81%a8unity%e3%82%92%e5%ad%a6%e3%81%b6-%e2%91%a2","status":"publish","type":"post","link":"https:\/\/dalomo.net\/blog\/2022\/07\/03\/1773\/","title":{"rendered":"\u300e\u6771\u4eac\u30d1\u30bd\u30b3\u30f3\u30af\u30e9\u30d6\u300f\u3067\u30a2\u30a4\u30c9\u30eb\u3068Unity\u3092\u5b66\u3076 \u2462 \u7389\u8ee2\u304c\u3057\u30b2\u30fc\u30e0"},"content":{"rendered":"<h1>\u7389\u8ee2\u304c\u3057\u30b2\u30fc\u30e0<\/h1>\n<p>\u3053\u306e\u524d\u306e\u8a18\u4e8b\u307e\u3067\u4f5c\u3063\u3066\u305f\u30b8\u30e3\u30f3\u30d7\u30b2\u30fc\u30e0\u306e\u5f71\u3082\u5f62\u3082\u306a\u304f\u306a\u308a\u3001\u524d\u56de\u3001\u524d\u3005\u56de\u306f\u53cc\u516d\u3092\u4f5c\u3063\u3066\u3044\u305f\u3002\u305f\u3060\u8b1b\u5e2b\u306e\u65b9\u304c\u3042\u308b\u7a0b\u5ea6\u4f5c\u3063\u3066\u304f\u308c\u3066\u3044\u3066\u3001\u305d\u308c\u3092\u5b8c\u6210\u3055\u305b\u308b\u3068\u3044\u3046\u5f62\u3060\u3063\u305f\u3002\u305d\u306e\u9014\u4e2d\u307e\u3067\u4f5c\u3063\u3066\u3042\u308b\u53cc\u516d\u3092\u624b\u306b\u5165\u308c\u3089\u308c\u306a\u3044\u306e\u3067\u3001\u53cc\u516d\u306b\u95a2\u3057\u3066\u306f\u30b9\u30eb\u30fc\u3059\u308b\u3002\u3067\u3001\u4eca\u56de\u306f\uff11\u304b\u3089\u7389\u8ee2\u304c\u3057\u30b2\u30fc\u30e0\u3092\u4f5c\u308b\u3068\u3044\u3046\u3053\u3068\u3060\u3063\u305f\u3002\u4e43\u6728\u5742\u3061\u3083\u3093\u540c\u69d8\u81ea\u5206\u3082\u5b8c\u5168\u306b\u5fd8\u308c\u3066\u3044\u308b\u306e\u3067\u624b\u63a2\u308a\u3067\u3084\u3063\u3066\u3044\u304f\u3002<\/p>\n<h2>\u3069\u3093\u306a\uff1f<\/h2>\n<p><a href=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk01.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1776 size-medium\" src=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk01-300x169.png\" alt=\"\" width=\"300\" height=\"169\" srcset=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk01-300x169.png 300w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk01-120x68.png 120w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk01-160x90.png 160w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk01-320x180.png 320w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk01.png 750w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk02.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1777 size-medium\" src=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk02-300x169.png\" alt=\"\" width=\"300\" height=\"169\" srcset=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk02-300x169.png 300w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk02-768x432.png 768w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk02-120x68.png 120w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk02-160x90.png 160w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk02-320x180.png 320w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk02.png 1024w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u3053\u3093\u306a\u3002\u5f13\u6728\u3061\u3083\u3093\u306f\u30d1\u30c1\u30f3\u30b3\u3063\u3066\u8a00\u3063\u3066\u305f\u3002\u78ba\u304b\u306b\uff5e\u3002<\/p>\n<h2>\u958b\u767a<\/h2>\n<p>\u756a\u7d44\u4e0a\u7701\u7565\u3055\u308c\u3066\u308b\u90e8\u5206\u3082\u3042\u308b\u306e\u3067\u3001\u53c2\u8003\u306b\u3057\u3064\u3064\u3084\u3063\u305f\u3053\u3068\u3063\u3066\u611f\u3058\u3002<\/p>\n<h3>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u4f5c\u6210<\/h3>\n<p>Unity Hub\u3067\u65b0\u3057\u3044\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3001\uff12D\u3001\u540d\u524d\u5165\u308c\u3066\u4f5c\u6210\u3002Window\u2192Layouts\u30672by3\u306b\u5909\u66f4\u3002<\/p>\n<h2>\u4e2d\u592e\u306e\u6b6f\u8eca\u3092\u4f5c\u308b<\/h2>\n<h3>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u4f5c\u6210<\/h3>\n<p>GameObject\u21922Dobject\u2192Sprites\u2192Square\u3067\u4f5c\u308b\u3002\u4f5c\u3063\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u56db\u65b9\u306b\u9752\u3044\u4e38\u304c\u3042\u308b\u306e\u3067\u305d\u308c\u3092\u5f15\u3063\u5f35\u308b\u3068\u5f62\u3092\u5909\u3048\u3089\u308c\u308b\u3002\u6b6f\u8eca\u306e\u6b6f\u3092\u4f5c\u308a\u305f\u3044\u306e\u3067\u7d30\u9577\u3044\u5f62\u306b\u3059\u308b\u3002<\/p>\n<h3>\u5f53\u305f\u308a\u5224\u5b9a\u3092\u4ed8\u3051\u308b<\/h3>\n<p>Inspector\u5185\u3067Add Component\u3001Physics2D\u2192BoxCollider2D<\/p>\n<h3>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u30b3\u30d4\u30fc<\/h3>\n<p>Hierarchy\u306b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u30c9\u30e9\u30c3\u30b0\u3057\u3066\uff5e\u307f\u305f\u3044\u306a\u524d\u56de\u306e\u30d7\u30ec\u30cf\u30d6\u5316\u3082\u3042\u308b\u3051\u3069\u3001Hierarchy\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u540d\u3092\u53f3\u30af\u30ea\u30c3\u30af\u3067\u30b3\u30d4\u307a\u304c\u3067\u304d\u305f\u306e\u3067\u3001\u305d\u308c\u3067\u6b6f\u3092\u5897\u3084\u3059\u3002<\/p>\n<h3>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u89d2\u5ea6\u3092\u3064\u3051\u308b<\/h3>\n<p>Scene\u753b\u9762\u306b\u56de\u8ee2\u77e2\u5370\u307f\u305f\u3044\u306a\u30de\u30fc\u30af\u304c\u3042\u308b\u306e\u3067\u305d\u308c\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u5468\u308a\u306b\u9752\u3044\u5186\u304c\u8868\u793a\u3055\u308c\u308b(RotateTool)\u3002\u305d\u308c\u3092\u30c9\u30e9\u30c3\u30b0\u3059\u308b\u3068\u89d2\u5ea6\u3092\u4ed8\u3051\u3089\u308c\u308b\u3002\u4ed6\u306b\u3001Inspector\u5185\u306eTransform\u3067rotation\u306eZ\u306e\u5024\u3092\u5909\u3048\u308b\u3053\u3068\u3067\u89d2\u5ea6\u304c\u4ed8\u3051\u3089\u308c\u308b\u3002\u304d\u3063\u3061\u308a\u3084\u308b\u306a\u3089\u3053\u3063\u3061\u304b\u306a\uff1f<\/p>\n<p><a href=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk03.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1778 size-medium\" src=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk03-300x163.png\" alt=\"\" width=\"300\" height=\"163\" srcset=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk03-300x163.png 300w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk03.png 750w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u3067\u304b\u3044\u3002<\/p>\n<h3>\u6b6f\u306b\u89aa\u5b50\u95a2\u4fc2\u3092\u4f5c\u308b<\/h3>\n<p>\u6b6f\u304c\u30d0\u30e9\u30d0\u30e9\u306a\u306e\u3067\u304f\u3063\u3064\u3051\u308b\u2026\u3067\u306f\u306a\u304f\u3066\u3001\u89aa\u5b50\u95a2\u4fc2\u3092\u4f5c\u308b\u3068\u3044\u3046\u3053\u3068\u3089\u3057\u3044\u3002<\/p>\n<p>Hierarchy\u306e\u7a7a\u767d\u306e\u6240\u3067\u53f3\u30af\u30ea\u30c3\u30af\u3001CreateEmpty\u3002\u305d\u3093\u3067\u3001\u3067\u304d\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u4e2d\u306bSquare\u3092\u30c9\u30e9\u30b0\uff06\u30c9\u30ed\u30c3\u30d7\u3059\u308b\u3002\u305d\u3057\u305f\u3089\u3001\u6b6f\u8eca\u306bRigidbody2D\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u4ed8\u4e0e\u3059\u308b\u3002<\/p>\n<h3>\u56de\u3059\u305f\u3081\u306b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u66f8\u304f<\/h3>\n<p>\u6b6f\u8eca\u306eAddComponent\u3067NewScript\u3002<\/p>\n<pre><code class=\"cs\">public class Kaiten : MonoBehaviour\r\n{\r\n    \/\/ Start is called before the first frame update\r\n    void Start()\r\n    {\r\n\r\n    }\r\n\r\n    \/\/ Update is called once per frame\r\n    void FixedUpdate()\r\n    {\r\n        m_rigidbody.angularVelocity = 60.0f;\r\n    }\r\n\r\n    [SerializeField]\r\n    Rigidbody2D m_rigidbody;\r\n}<\/code><\/pre>\n<p>\u3053\u3046\u66f8\u304f\u3002<\/p>\n<h3>\u8a66\u3057\u306b\u52d5\u304b\u3059<\/h3>\n<p>\u6b6f\u8eca\u306eGravityScale\u30920\u306b\u3059\u308b\u3002\u518d\u751f\u30dc\u30bf\u30f3\u3092\u62bc\u3059\u2026\u52d5\u304b\u306a\u3044\uff01\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u308b\u3002<\/p>\n<blockquote><p>UnassignedReferenceException: The variable m_rigidbody of Kaiten has not been assigned.<br \/>\nYou probably need to assign the m_rigidbody variable of the Kaiten script in the inspector.<br \/>\nKaiten.FixedUpdate () (at Assets\/Kaiten.cs:15)<\/p><\/blockquote>\n<p>\u3048\u3048\uff5e\u3002\u307e\u3041\u78ba\u304b\u306b\u4eca\u56deStart\u306bGetComponent()\u3063\u3066\u66f8\u3044\u3066\u306a\u3044\u304b\u3089\u3001\u306a\u3093\u3067\u3060\u308d\u3046\u3068\u306f\u601d\u3063\u305f\u3093\u3060\u3051\u3069\u3055\u3002\u8272\u3005\u8abf\u3079\u3066\u307f\u305f\u3068\u3053\u308d\u3001SerializeField\u306e\u8a71\u304c\u3042\u308a<\/p>\n<p><a href=\"https:\/\/tech.pjin.jp\/blog\/2021\/12\/23\/unity-serializefield\">https:\/\/tech.pjin.jp\/blog\/2021\/12\/23\/unity-serializefield<\/a><\/p>\n<p>\u6b6f\u8eca\u306eInspactor\u306bRigidbody\u3092\u6307\u5b9a\u3057\u3066\u3084\u308c\u3070\u3088\u3055\u305d\u3046\u3002<\/p>\n<p><a href=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk04.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1779 size-medium\" src=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk04-300x163.png\" alt=\"\" width=\"300\" height=\"163\" srcset=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk04-300x163.png 300w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk04.png 750w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u305d\u3057\u305f\u3089\u518d\u5ea6\u3001\u518d\u751f\u30dc\u30bf\u30f3\u3092\u62bc\u3059\u3068<\/p>\n<p><iframe loading=\"lazy\" title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/B3VFvO6Na-A\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>\u3067\u304d\u305f\uff01\u3068\u308a\u3042\u3048\u305a\u4eca\u65e5\u306e\u4ed5\u4e8b\u7d42\u308f\u308a\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7389\u8ee2\u304c\u3057\u30b2\u30fc\u30e0 \u3053\u306e\u524d\u306e\u8a18\u4e8b\u307e\u3067\u4f5c\u3063\u3066\u305f\u30b8\u30e3\u30f3\u30d7\u30b2\u30fc\u30e0\u306e\u5f71\u3082\u5f62\u3082\u306a\u304f\u306a\u308a\u3001\u524d\u56de\u3001\u524d\u3005\u56de\u306f\u53cc\u516d\u3092\u4f5c\u3063\u3066\u3044\u305f\u3002\u305f\u3060\u8b1b\u5e2b\u306e\u65b9\u304c\u3042\u308b\u7a0b\u5ea6\u4f5c\u3063\u3066\u304f\u308c\u3066\u3044\u3066\u3001\u305d\u308c\u3092\u5b8c\u6210\u3055\u305b\u308b\u3068\u3044\u3046\u5f62\u3060\u3063\u305f\u3002\u305d\u306e\u9014\u4e2d\u307e\u3067\u4f5c\u3063\u3066\u3042\u308b\u53cc\u516d\u3092\u624b\u306b\u5165\u308c\u3089\u308c\u306a &hellip; <a href=\"https:\/\/dalomo.net\/blog\/2022\/07\/03\/1773\/\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":1749,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[9],"tags":[166,165],"class_list":["post-1773","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-9","tag-unity","tag-165"],"_links":{"self":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts\/1773","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/comments?post=1773"}],"version-history":[{"count":5,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts\/1773\/revisions"}],"predecessor-version":[{"id":1825,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts\/1773\/revisions\/1825"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/media\/1749"}],"wp:attachment":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/media?parent=1773"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/categories?post=1773"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/tags?post=1773"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}