<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>uni-mal</author_name>
  <author_url>https://blog.hatena.ne.jp/uni-mal/</author_url>
  <blog_title>Unityでインディゲームを作る！</blog_title>
  <blog_url>https://indie-game-creation-with-unity.hatenablog.com/</blog_url>
  <categories>
    <anon>Unity</anon>
    <anon>UnityのためのC#</anon>
  </categories>
  <description>少し気になったことがあったので書きます。環境はWindows10でUnity2020.3.22です。お前の使い方、環境が悪い！案件だったらすいません。と、この記事を書いた後に調べてみたら、どうやら自分の勘違いでした！ 結論から言えば、GetComponentInParentやGetComponentInChildrenは指定したコンポーネントをヒエラルキー上で探索するメソッドだが、自オブジェクトもその対象になるので、スクリプトが装着されているオブジェクトにそのコンポーネントがある場合は、そのコンポーネントを返す、ということのようです。 ↓以後の文章はきちんと調べずに、自分の勘違いで勝手に怒りな…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Findie-game-creation-with-unity.hatenablog.com%2Fentry%2Fgetcomponent-in-parent&quot; title=&quot;UnityのGetComponentInParentとGetComponentInChildrenの挙動おかしくなってないですか？と思ったら勘違いでした。 - Unityでインディゲームを作る！&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url>https://cdn-ak.f.st-hatena.com/images/fotolife/u/uni-mal/20211110/20211110203937.jpg</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2021-11-10 21:45:50</published>
  <title>UnityのGetComponentInParentとGetComponentInChildrenの挙動おかしくなってないですか？と思ったら勘違いでした。</title>
  <type>rich</type>
  <url>https://indie-game-creation-with-unity.hatenablog.com/entry/getcomponent-in-parent</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
