Creating a grid mesh programmatically in Unity 3D

using System; using System.Collections.Generic; using UnityEngine; public static class Grid { public static void Create(bool withCollision) { GameObject gridObject = new GameObject(); gridObject.name = “Grid”; gridObject.transform.position = Vector3.zero; List<int> triangles = new List<int>(); List<Vector3> vertices = new List<Vector3>(); List<Vector2> uvs = new List<Vector2>(); List<int> collision_triangles…

Accessing strings in c++ from c#

Scenario; You may have some c++ code you wish to output string data to be used in a c# application. #include <stdio.h> #include <string.h> extern “C” { __declspec(dllexport) int GetString(char* buf,int n) { strncpy(buf,”my string in cpp”, n); return 0; } } using System.Runtime.InteropServices; [DllImport(“mycppdll.dll”,…