{"id":1506,"date":"2022-03-17T20:09:09","date_gmt":"2022-03-17T20:09:09","guid":{"rendered":"https:\/\/golemitegames.com\/?post_type=docs&#038;p=1506"},"modified":"2022-03-17T20:18:40","modified_gmt":"2022-03-17T20:18:40","password":"","slug":"objectplacer","status":"publish","type":"docs","link":"https:\/\/golemitegames.com\/index.php\/docs\/objectplacer\/","title":{"rendered":"ObjectPlacer"},"content":{"rendered":"\n<p><strong>public void PlaceObject(GameObject obj,<\/strong> <strong>Vector3 placePos,<\/strong> <strong>GridSquare grid,<\/strong> <strong>int layer)<\/strong><\/p>\n\n\n\n<p>This function places the object on the grid and changes the layer back to the original layer the object was on. You will need the obj, its position to place it, the grid to change the cell status and the object&#8217;s original layer. <\/p>\n\n\n\n<p>It also adds the GridObject script to it, to keep a reference to the grid it is on.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-csharp\" data-lang=\"C#\"><code>\/\/Places an obj on left mouse click\nObjectPlacer objectPlacer;\nGridSelector gridSelector;\nGridSquare grid;\npublic GameObject myObject;\n\nvoid Update()\n{\n    if (Input.GetMouseButton(0)) \n    {\n        objectPlacer.PlaceObject(myObject, gridSelector.GetSelectorPosition(), grid, myObject.layer)\n    }\n}<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>public void PlaceObject(GameObject obj, Vector3 placePos, GridSquare grid, int layer) This function places the object on the grid and changes the layer back to the original layer the object was on. You will need the obj, its position to place it, the grid to change the cell status and the object&#8217;s original layer. It also [&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":[28],"doc_tag":[],"class_list":["post-1506","docs","type-docs","status-publish","hentry","doc_category-scripting"],"acf":[],"aioseo_notices":[],"year_month":"2026-04","word_count":101,"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\/"}],"doc_tag_info":[],"_links":{"self":[{"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/docs\/1506","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=1506"}],"version-history":[{"count":4,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/docs\/1506\/revisions"}],"predecessor-version":[{"id":1511,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/docs\/1506\/revisions\/1511"}],"wp:attachment":[{"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/media?parent=1506"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/doc_category?post=1506"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/doc_tag?post=1506"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}