{"id":1839,"date":"2022-09-20T01:41:54","date_gmt":"2022-09-19T16:41:54","guid":{"rendered":"https:\/\/dalomo.net\/blog\/?p=1839"},"modified":"2022-09-20T01:41:54","modified_gmt":"2022-09-19T16:41:54","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%a7","status":"publish","type":"post","link":"https:\/\/dalomo.net\/blog\/2022\/09\/20\/1839\/","title":{"rendered":"\u300e\u6771\u4eac\u30d1\u30bd\u30b3\u30f3\u30af\u30e9\u30d6\u300f\u3067\u30a2\u30a4\u30c9\u30eb\u3068Unity\u3092\u5b66\u3076 \u2467 \u8131\u51fa\u30b2\u30fc\u30e0"},"content":{"rendered":"<h1>\u8131\u51fa\u30b2\u30fc\u30e0<\/h1>\n<p>\u5f15\u304d\u7d9a\u304d\u3002\u306a\u3093\u304b\u3057\u308c\u3063\u3068\u9805\u76ee\u306e\u5185\u5bb9\u5909\u308f\u3063\u3066\u306d\uff1f<\/p>\n<p><a href=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/09\/eg02.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-1840\" src=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/09\/eg02-300x169.png\" alt=\"\" width=\"300\" height=\"169\" srcset=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/09\/eg02-300x169.png 300w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/09\/eg02-768x432.png 768w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/09\/eg02-120x68.png 120w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/09\/eg02-160x90.png 160w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/09\/eg02-320x180.png 320w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/09\/eg02.png 960w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u307e\u3041\u3044\u3044\u3093\u3060\u3051\u3069\u3055\u3002<\/p>\n<h2>\u4f55\u3092\u3059\u308b\u304b<\/h2>\n<p>\u3061\u3087\u3063\u3068\u6574\u7406\u3059\u308b\u3002<\/p>\n<p>\u4eca\u4f5c\u3063\u3066\u308b\u306e\u306f\u300c\u9375\u3092\u4f7f\u3063\u3066\u6249\u3092\u958b\u3051\u308b\u30b2\u30fc\u30e0\u300d\u3002\u524d\u56de\u307e\u3067\u3067\u3001\u30af\u30ea\u30c3\u30af\u3057\u305f\u3089\u6249\u304c\u958b\u304f\u3001\u3068\u3044\u3046\u3068\u3053\u308d\u304c\u4f5c\u308c\u305f\u3002\u73fe\u5728\u307e\u3067\u306b\u6559\u3048\u3066\u3082\u3089\u3063\u305f\u5185\u5bb9\u3092\u5229\u7528\u3057\u3066\u3001\u76ee\u6a19\u307e\u3067\u306b\u3042\u3068\u4f55\u304c\u5fc5\u8981\u3060\u308d\u3046\u304b\u3002<\/p>\n<p>\u305d\u3082\u305d\u3082\u300c\u9375\u3092\u4f7f\u3063\u3066\u6249\u3092\u958b\u3051\u308b\u30b2\u30fc\u30e0\u300d\u3068\u3057\u3066\u671f\u5f85\u3055\u308c\u308b\u52d5\u4f5c\u3068\u306f\u4f55\u3060\u308d\u3046\u3002\u30b9\u30bf\u30fc\u30c8\u304b\u3089\u5206\u89e3\u3057\u3066\u307f\u308b\u3002<\/p>\n<ol>\n<li>\u753b\u9762\u306b\u6249\u3068\u9375\u304c\u8868\u793a\u3055\u308c\u3066\u3044\u308b<\/li>\n<li>\u3053\u306e\u6642\u70b9\u3067\u6249\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u3082\u958b\u304b\u306a\u3044<\/li>\n<li>\u9375\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\uff08\u9375\u3092\u53d6\u5f97\u3059\u308b\uff09<\/li>\n<li>\u9375\u304c\u6d88\u3048\u308b\uff08\u9375\u3092\u53d6\u5f97\u3057\u305f\u3053\u3068\u306e\u6f14\u51fa\uff09<\/li>\n<li>\u6249\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b<\/li>\n<li>\u6249\u304c\u958b\u304f<\/li>\n<li>\u8131\u51fa\u6210\u529f\u306e\u8868\u793a\u304c\u73fe\u308c\u308b<\/li>\n<\/ol>\n<p>\u5927\u4f53\u3053\u3093\u306a\u611f\u3058\u304b\u306a\u3041\u3002\u524d\u56de\u307e\u3067\u30675\u30686\u306e\u90e8\u5206\u3092\u4f5c\u308c\u305f\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3053\u3053\u306b\u300c\u9375\u3092\u53d6\u5f97\u3057\u305f\u304b\u3069\u3046\u304b\u300d\u3068\u3044\u30462\u30683\u306e\u8981\u7d20\u3092\u52a0\u3048\u308b\u3053\u3068\u306b\u306a\u308b\u3002\u3067\u306f\u3053\u3053\u3067\u3001\u305d\u306e\u8981\u7d20\u3092\u5b9f\u73fe\u3059\u308b\u305f\u3081\u306e\u4ed5\u7d44\u307f\u3092\u8003\u3048\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3002\u3053\u3053\u3067\u3044\u3046\u4ed5\u7d44\u307f\u3068\u3044\u3046\u306e\u306f\u30d5\u30ed\u30fc\u30c1\u30e3\u30fc\u30c8\u7684\u306a\u3082\u306e\u3067\u3001Unity\u4e0a\u3067\u3069\u3046\u5b9f\u73fe\u3059\u308b\u304b\u3001\u3068\u3044\u3046\u8996\u70b9\u3068\u306f\u307e\u305f\u5225\u3060\u3002\u3044\u3063\u305f\u3093\u30015\u30686\u3067\u306f\u3069\u3046\u3044\u3046\u4ed5\u7d44\u307f\u306b\u3057\u305f\u304b\u632f\u308a\u8fd4\u308b\u3068<\/p>\n<ol>\n<li>\u753b\u9762\u306b\u6249\u3092\u8868\u793a\u3059\u308b<\/li>\n<li>\u6249\u306e\u6240\u306b\u306f\u900f\u660e\u306a\u30dc\u30bf\u30f3\u3092\u8a2d\u7f6e\u3059\u308b<\/li>\n<li>\u6249\uff1d\u900f\u660e\u306a\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u3001\u6249\u306e\u753b\u50cf\u3092\u9589\u3058\u3066\u3044\u308b\u3082\u306e\u304b\u3089\u958b\u3044\u3066\u308b\u3082\u306e\u3078\u5dee\u3057\u66ff\u3048\u308b<\/li>\n<\/ol>\n<p>\u3068\u3044\u3046\u4ed5\u7d44\u307f\u3067\u3001\u30af\u30ea\u30c3\u30af\u3057\u305f\u3089\u6249\u304c\u958b\u304f\u3068\u3044\u3046\u52d5\u4f5c\u3092\u5b9f\u73fe\u3067\u304d\u305f\u3002\u524d\u56de\u306f\u3053\u308c\u3092Unity\u4e0a\u306b\u843d\u3068\u3057\u8fbc\u3093\u3060\u308f\u3051\u3060\u3002\u3053\u3053\u306b2\u30683\u306e\u8981\u7d20\u3092\u52a0\u3048\u308b\u306b\u306f\u3069\u3046\u3057\u305f\u3089\u3088\u3044\u3060\u308d\u3046\u304b\u3002<\/p>\n<p>2\u30683\u306e\u8981\u7d20\u3068\u3044\u3046\u306e\u306f\u300c\u9375\u3092\u53d6\u5f97\u3057\u305f\u304b\u3069\u3046\u304b\u300d\u306b\u3088\u3063\u3066\u51e6\u7406\u3092\u5206\u3051\u308b\u3053\u3068\u306b\u3088\u3063\u3066\u5b9f\u73fe\u3067\u304d\u308b\u3002\u300c\u9375\u3092\u53d6\u5f97\u3057\u305f\u304b\u3069\u3046\u304b\u300d\u306f\u3001\u53cc\u516d\u306e\u6642\u306b\u3084\u3063\u305f\u30d5\u30e9\u30b0\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u5224\u5b9a\u3067\u304d\u308b\u3002\u3064\u307e\u308a\u3001\u300c\u3082\u3057\u9375\u3092\u53d6\u5f97\u3057\u3066\u3044\u305f\u3089\u3001\u6249\u3092\u30af\u30ea\u30c3\u30af\u3057\u305f\u6642\u306b\u6249\u304c\u958b\u304f\u300d\u3068\u3044\u3046\u52d5\u4f5c\u306e\u4ed5\u7d44\u307f\u3092\u8003\u3048\u308b\u3053\u3068\u306b\u306a\u308b\u3002\u3058\u3083\u3042<\/p>\n<ol>\n<li>\u753b\u9762\u306b\u9375\u3092\u8868\u793a\u3059\u308b<\/li>\n<li>\u300c\u9375\u3092\u53d6\u5f97\u3057\u305f\u304b\u3069\u3046\u304b\u300d\u3092\u5224\u5b9a\u3059\u308b\u305f\u3081\u306e\u30d5\u30e9\u30b0\u3092\u7528\u610f\u3059\u308b<\/li>\n<li>\u9375\u3068\u540c\u5f62\u306b\u900f\u660e\u306a\u30dc\u30bf\u30f3\u3092\u8a2d\u7f6e\u3059\u308b<\/li>\n<li>\u9375\uff1d\u900f\u660e\u306a\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u305f\u3089\u30012\u306e\u30d5\u30e9\u30b0\u3092\u7acb\u3066\u308b\uff08\u30aa\u30f3\u306b\u3059\u308b\u30fbtrue\u3092\u5165\u308c\u308b\uff09<\/li>\n<li>\u6249\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u3001\u30d5\u30e9\u30b0\u304b\u3089\u300c\u9375\u3092\u53d6\u5f97\u3057\u305f\u304b\u3069\u3046\u304b\u300d\u3092\u5224\u5b9a\u3057\u3001\u53d6\u5f97\u3057\u3066\u3044\u305f\u3089\u6249\u306e\u753b\u50cf\u3092\u5dee\u3057\u66ff\u3048\u308b<\/li>\n<\/ol>\n<p>\u3068\u3044\u3046\u4ed5\u7d44\u307f\u3067\u5b9f\u73fe\u3067\u304d\u305d\u3046\u3060\u3002\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u3053\u308c\u3092Unity\u4e0a\u306b\u843d\u3068\u3057\u8fbc\u3093\u3067\u3044\u304f\u3002<\/p>\n<h2>\u30d5\u30e9\u30b0\u304c\u7acb\u3063\u3066\u3044\u306a\u3044\u6642\u306f\u6249\u304c\u958b\u304b\u306a\u3044\u3088\u3046\u306b\u3059\u308b<\/h2>\n<p>Door\u3092<\/p>\n<pre>using System.Collections;\r\nusing System.Collections.Generic;\r\nusing UnityEngine;\r\nusing UnityEngine.UI;\r\n\r\npublic class Door : MonoBehaviour\r\n{\r\n    public Image image;\r\n    public Sprite sprite;\r\n    public bool flag = false;\r\n\r\n    public void Open()\r\n    {\r\n        if (flag == true)\r\n        {\r\n            image.sprite = sprite;\r\n        }\r\n    }\r\n\r\n}<\/pre>\n<p>\u3053\u3046\u5909\u3048\u305f\u3002\u30d5\u30e9\u30b0\u7528\u5909\u6570\u3092flag\u3063\u3066\u547d\u540d\u3057\u3061\u3083\u3044\u3051\u306a\u3044\u3066\u3069\u3063\u304b\u3067\u898b\u305f\u3051\u3069\u305d\u308c\u306f\u7f6e\u3044\u3068\u3044\u3066\u3001\u3053\u306eflag\u304c\u9375\u3092\u6301\u3063\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u3092\u8868\u3059\u3053\u3068\u306b\u306a\u308b\u3002<\/p>\n<h2>\u9375\u306e\u753b\u50cf\u3068\u30dc\u30bf\u30f3\u3092\u7528\u610f<\/h2>\n<p>Canvas\u4e0a\u306bImage\u3067\u9375\u306e\u753b\u50cf\u3092\u8aad\u307f\u8fbc\u307f\u3001\u900f\u660e\u306a\u30dc\u30bf\u30f3\u3092\u4f5c\u6210\u3059\u308b\u3002<\/p>\n<p><a href=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/09\/eg03.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-1843\" src=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/09\/eg03-300x163.png\" alt=\"\" width=\"300\" height=\"163\" srcset=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/09\/eg03-300x163.png 300w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/09\/eg03-768x417.png 768w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/09\/eg03.png 1000w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h2>\u9375\u3092\u30af\u30ea\u30c3\u30af\u3057\u305f\u3089\u30d5\u30e9\u30b0\u3092\u7acb\u3066\u308b<\/h2>\n<p>\u65b0\u305f\u306bKey\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u308b\u3002<\/p>\n<pre>using System.Collections;\r\nusing System.Collections.Generic;\r\nusing UnityEngine;\r\n\r\npublic class Key : MonoBehaviour\r\n{\r\n    public Door door;\r\n    \r\n    public void PickUp()\r\n    {\r\n        door.flag = true;\r\n    }\r\n}<\/pre>\n<p>Image\u3084Sprite\u3084Text\u3068\u540c\u3058\u304f\u3001\u81ea\u5206\u3067\u4f5c\u3063\u305fDoor\u3067\u3082\u5909\u6570\u3092\u5ba3\u8a00\u3067\u304d\u308b\u3093\u3060\u306a\u3041\u3002\u8003\u3048\u3066\u307f\u308a\u3083\u305d\u3046\u306a\u3093\u3060\u3051\u3069\u3001\u6559\u308f\u3089\u306a\u3044\u3068\u96e3\u3057\u3044\u3088\u306a\u3053\u308c\u306f\u3002PickUp\u95a2\u6570\u5185\u3067\u306fDoor\u304c\u6301\u3063\u3066\u308bflag\u306btrue\u3092\u4ee3\u5165\u3057\u3066\u3044\u308b\u3002\u3053\u306e\u30d5\u30e9\u30b0\u306f\u9375\u3092\u6301\u3063\u3066\u3044\u308b\u304b\u306e\u30d5\u30e9\u30b0\u306a\u306e\u3067\u3001\u3053\u308c\u3067\u9375\u3092\u6301\u3063\u3066\u3044\u308b\u3053\u3068\u306b\u306a\u308b\u3002\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4fdd\u5b58\u3057\u305f\u3089\u9375\u7528\u306eButton\u306eAddComponent\u306bD&amp;D\u3057\u3001Inspector\u306eKey(script)\u306eDoor\u306b\u306f\u6249\u306eImage\u3001onClick\u306b\u306f\u81ea\u5206\u81ea\u8eab\u3067\u3042\u308bButton\u3001Function\u306bPickUp\u3092\u8a2d\u5b9a\u3059\u308b\u3002<\/p>\n<p><a href=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/09\/eg04.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-1844\" src=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/09\/eg04-300x163.png\" alt=\"\" width=\"300\" height=\"163\" srcset=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/09\/eg04-300x163.png 300w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/09\/eg04-768x417.png 768w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/09\/eg04.png 1000w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u305d\u3057\u305f\u3089\u5b9f\u884c\u3059\u308b\u3068<\/p>\n<p><iframe loading=\"lazy\" title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/N8vmUVYe3V8\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>\u3067\u304d\u305f\uff5e\u3002\u6b21\u56de\u3067\u5b8c\u6210\u304b\u306a\uff1f<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8131\u51fa\u30b2\u30fc\u30e0 \u5f15\u304d\u7d9a\u304d\u3002\u306a\u3093\u304b\u3057\u308c\u3063\u3068\u9805\u76ee\u306e\u5185\u5bb9\u5909\u308f\u3063\u3066\u306d\uff1f \u307e\u3041\u3044\u3044\u3093\u3060\u3051\u3069\u3055\u3002 \u4f55\u3092\u3059\u308b\u304b \u3061\u3087\u3063\u3068\u6574\u7406\u3059\u308b\u3002 \u4eca\u4f5c\u3063\u3066\u308b\u306e\u306f\u300c\u9375\u3092\u4f7f\u3063\u3066\u6249\u3092\u958b\u3051\u308b\u30b2\u30fc\u30e0\u300d\u3002\u524d\u56de\u307e\u3067\u3067\u3001\u30af\u30ea\u30c3\u30af\u3057\u305f\u3089\u6249\u304c\u958b\u304f\u3001\u3068\u3044\u3046\u3068\u3053\u308d\u304c\u4f5c\u308c\u305f\u3002\u73fe &hellip; <a href=\"https:\/\/dalomo.net\/blog\/2022\/09\/20\/1839\/\">\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-1839","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\/1839","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=1839"}],"version-history":[{"count":3,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts\/1839\/revisions"}],"predecessor-version":[{"id":1845,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts\/1839\/revisions\/1845"}],"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=1839"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/categories?post=1839"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/tags?post=1839"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}