Search Unity

Instantiate Prefab within a cube collider on empty gameobject

Discussion in 'Scripting' started by jorn818, Nov 20, 2014.

  1. jorn818

    jorn818

    Joined:
    May 12, 2013
    Posts:
    100
    So I have an infinite terrain but it's pretty boring so what I need, Is a script that spawns a prefab (a building or a tower loot etc) within a cube collider (this is just pure for precision spawning) I need the script to be able to put on a empty gameobject and then when I use the terrain brush to put empty gameobjects on the terrain it will spawn buildings infinitely on low recources and quite easily, I just know this would be a great asset to have for the unity community my question really is or my questions are:


    - Is it possible

    - How would I do this

    (If someone could provide a script already (if it exists so I don't have to reinvent the wheel)
    ^But really all help is welcome, And the Unity community has helped me out so much in the past so i'm sure you guys can help me out.
    - Is it hard to code

    - Can empty gameobject be put on the terrain with the terrain brush

    - Bonus question: For performance reasons, is it possible to spawn the buildings only if 400m in players range.




    Imagine the possibilities!!!! maxresdefault.jpg