Example #1
0
 public static void AttachToTransformAsChild(GameObject gridGameObject)
 {
     if (gridGameObject.GetComponent <Grid2DComponent> ( ))
     {
         Grid2DContainer container = FindObjectOfType <Grid2DContainer> ( );
         gridGameObject.transform.SetParent(container.transform);
     }
 }
    /* Instantiate an instance of the grid as a GameObject
     * and instantiate each vertex of the grid as a child GameObject. */
    private void Instantiate2DGridObject()
    {
        grid2DObject = new GameObject("Grid2D");
        grid2DObject.AddComponent <Grid2DComponent> ( );

        Grid2DContainer.AttachToTransformAsChild(grid2DObject);

        CalculateVerticies( );
        SpawnVerticies(grid2DObject);
    }