{"id":1950,"date":"2022-08-04T16:17:42","date_gmt":"2022-08-04T16:17:42","guid":{"rendered":"https:\/\/golemitegames.com\/?post_type=docs&#038;p=1950"},"modified":"2022-08-04T16:29:01","modified_gmt":"2022-08-04T16:29:01","password":"","slug":"objectstorage","status":"publish","type":"docs","link":"https:\/\/golemitegames.com\/index.php\/docs\/objectstorage\/","title":{"rendered":"ObjectStorage"},"content":{"rendered":"\n<p>This class works out of the box by adding the <strong>GameObject<\/strong>&#8216;s to <strong>Dictionaries<\/strong> when placed on the grid. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" style=\"font-size:22px\">public static void AddTypeObject(int prefabId, GameObject obj)<\/h2>\n\n\n\n<p>This method is called when placing an object via the <strong>ObjectPlacer<\/strong> to add the object to the type dictionary. <\/p>\n\n\n\n<p>The <strong>prefabId<\/strong> is initially set via the <strong>SelectObject<\/strong> button as it is useful to be able to obtain a list of all objects of type at once. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" style=\"font-size:22px\">public static void RemoveTypeObject(int prefabId, GameObject obj)<\/h2>\n\n\n\n<p>This method does not delete objects, but removes them from the <strong>ObjectStorage<\/strong> <strong>Dictionary<\/strong> so they will not try to be accessed after being destroyed. <\/p>\n\n\n\n<p class=\"has-background-color has-text-color\">Note. If you destroy a <strong>GridObject<\/strong> via scripting outside of this packages scripts, you should be sure to use this method to also remove it from the <strong>Dictionary<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" style=\"font-size:22px\">public static List&lt;GameObject> GetObjectsOfType(int prefabId)<\/h2>\n\n\n\n<p>Returns a <strong>List&lt;GameObject><\/strong> should it find a list containing that <strong>prefabId<\/strong>. <\/p>\n\n\n\n<p>The <strong>prefabId<\/strong> is initially set via the <strong>SelectObject<\/strong> button. <\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>\/\/A list containing all GameObjects with that ID. \nList&lt;GameObject&gt; GOList = ObjectStorage.GetObjectsOfType(0);<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>This class works out of the box by adding the GameObject&#8216;s to Dictionaries when placed on the grid. public static void AddTypeObject(int prefabId, GameObject obj) This method is called when placing an object via the ObjectPlacer to add the object to the type dictionary. The prefabId is initially set via the SelectObject button as it [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"doc_category":[45],"doc_tag":[],"class_list":["post-1950","docs","type-docs","status-publish","hentry","doc_category-scripting-gridbuilder2"],"acf":[],"aioseo_notices":[],"year_month":"2026-04","word_count":177,"total_views":0,"reactions":{"happy":0,"normal":0,"sad":0},"author_info":{"name":"rickitz5h","author_nicename":"rickitz5h","author_url":"https:\/\/golemitegames.com\/index.php\/author\/rickitz5h\/"},"doc_category_info":[{"term_name":"Scripting","term_url":"https:\/\/golemitegames.com\/index.php\/docs-category\/scripting-gridbuilder2\/"}],"doc_tag_info":[],"_links":{"self":[{"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/docs\/1950","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/comments?post=1950"}],"version-history":[{"count":5,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/docs\/1950\/revisions"}],"predecessor-version":[{"id":1955,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/docs\/1950\/revisions\/1955"}],"wp:attachment":[{"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/media?parent=1950"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/doc_category?post=1950"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/doc_tag?post=1950"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}