<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Siratim Mustaquim</title>
    <description>The latest articles on Forem by Siratim Mustaquim (@shorotshishir).</description>
    <link>https://forem.com/shorotshishir</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1060818%2F76b7f33e-a420-49f9-a1bc-6fe521f1c06b.jpeg</url>
      <title>Forem: Siratim Mustaquim</title>
      <link>https://forem.com/shorotshishir</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/shorotshishir"/>
    <language>en</language>
    <item>
      <title>GameObject vs Transform : Unity</title>
      <dc:creator>Siratim Mustaquim</dc:creator>
      <pubDate>Mon, 15 Jul 2024 06:30:09 +0000</pubDate>
      <link>https://forem.com/shorotshishir/gameobject-vs-transform-unity-dbp</link>
      <guid>https://forem.com/shorotshishir/gameobject-vs-transform-unity-dbp</guid>
      <description>&lt;p&gt;In unity there are these questions related to Transform and GameObject, such as,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Which one to return as parameter?&lt;/li&gt;
&lt;li&gt;Which one to receive as a serialized field from Editor?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here goes the simple reference points to make the decision&lt;/p&gt;

&lt;h3&gt;
  
  
  What you get with Transform :
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Transformational info of a GameObject: position, location, scale (local and world)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Parent Child Transform Information : It handles the transformational information between parent and child GameObjects&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Gives reference access to the attached GameObject&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What you get with GameObject:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Permission to attach components: add multiple components / scripts (AddComponent())&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Lifecycle management : Create, destroy, enable and disable the GameObject along with the components.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What to Choose ?
&lt;/h3&gt;

&lt;p&gt;First match your use case with the above. Pick from that. Then consider the below issue&lt;/p&gt;

&lt;p&gt;GameObject can be enabled and disabled, Transforms can't be disabled. Having a reference of a GameObject can return null if it is disabled. At that stage enabling that gameobject is not possible via script as the reference is null ! In scenarios like these passing a &lt;code&gt;Transform&lt;/code&gt; or receiving a SerializedField as Transform via Editor makes more sense here. And you can always get the reference of the GameObject by using the gameobject property of the Transform !&lt;/p&gt;

&lt;p&gt;Happy Coding !&lt;/p&gt;

</description>
      <category>gamedev</category>
      <category>unity3d</category>
    </item>
  </channel>
</rss>
