<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Infinity Code Forum — Batch Object Placer]]></title>
		<link>https://forum.infinity-code.com/viewtopic.php?id=847</link>
		<atom:link href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=847&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Batch Object Placer.]]></description>
		<lastBuildDate>Wed, 30 May 2018 11:12:31 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Batch Object Placer]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3633#p3633</link>
			<description><![CDATA[<p>That is awesome - thank you so much for the prompt reply! I&#039;ll get going and see what I can do.</p><p>Thanks again for such a great asset!</p>]]></description>
			<author><![CDATA[null@example.com (stuarteve)]]></author>
			<pubDate>Wed, 30 May 2018 11:12:31 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3633#p3633</guid>
		</item>
		<item>
			<title><![CDATA[Re: Batch Object Placer]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3630#p3630</link>
			<description><![CDATA[<p>Hello.</p><p>Example:<br /></p><div class="codebox"><pre><code>using System.Collections.Generic;
using InfinityCode.RealWorldTerrain;
using UnityEditor;
using UnityEngine;

public class BatchPlacer: ScriptableWizard
{
    public GameObject prefab;
    public RealWorldTerrainContainer container;
    private List&lt;Vector2&gt; coords;

    [MenuItem(&quot;Window/Batch Placer&quot;)]
    static void CreateWizard()
    {
        BatchPlacer wizard = DisplayWizard(&quot;Batch Placer&quot;, typeof(BatchPlacer)) as BatchPlacer;
        wizard.container = FindObjectOfType&lt;RealWorldTerrainContainer&gt;();
    }

    void OnWizardCreate()
    {
        LoadCSVData();
        PlaceObjects();
    }

    private void PlaceObjects()
    {
        foreach (Vector2 coord in coords)
        {
            GameObject go = Instantiate(prefab);
            Vector3 pos;
            container.GetWorldPosition(coord, out pos);
            go.transform.position = pos;
        }
    }

    private void LoadCSVData()
    {
        // Here you load your CSV data

        GenerateDummyData(); // Generate dummy data
    }

    private void GenerateDummyData()
    {
        float tx = (float)container.leftLongitude;
        float ty = (float)container.topLatitude;
        float bx = (float)container.rightLongitude;
        float by = (float)container.bottomLatitude;

        int count = 20;
        coords = new List&lt;Vector2&gt;();
        for (int i = 0; i &lt; count; i++)
        {
            coords.Add(new Vector2(Random.Range(tx, bx), Random.Range(by, ty)));
        }
    }
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Tue, 29 May 2018 23:25:34 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3630#p3630</guid>
		</item>
		<item>
			<title><![CDATA[Batch Object Placer]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3624#p3624</link>
			<description><![CDATA[<p>Hi there</p><p>I would love to read in a CSV of coordinates and batch place a bunch of the objects there (without having to use the Object Placer to do each one individually). I have had a bit of a dig around in the code, but ended up getting a bit confused.</p><p>Is there any example script that could get me started on this?</p><p>Thanks for your help</p><p>Stuart</p>]]></description>
			<author><![CDATA[null@example.com (stuarteve)]]></author>
			<pubDate>Tue, 29 May 2018 12:30:21 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3624#p3624</guid>
		</item>
	</channel>
</rss>
