Draw 3D objects in code

My ultimate goal is to draw a house through code. Not something fancy, just a couple of walls and a roof will do for a start. Additionally, I want to be able to add windows to the walls. What’s the best way to do this?

I recommend you take a look at this : http://docs.unity3d.com/Documentation/ScriptReference/Mesh.html . You can change the code examples to C# by click on the drop-down box located at the top left of the page.

Although I would recommend you use a 3D modelling package to create something like a house. This could be useful if you prefer to make it by modelling : http://www.blender.org

Here is a starting point you could use. Make sure you attach this to a game object:

using UnityEngine;
using System.Collections;

public class Example : MonoBehaviour {
    void Start() {
        Mesh mesh = new Mesh();
        GetComponent<MeshFilter>().mesh = mesh;