using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NodesGenerator : MonoBehaviour {
public GameObject NodePrefab;
public int NodesNumberX = 16;
int NodesNumberY;
void Generate()
{
for (int x = 0; x < NodesNumberX; x++)
{
for (int y = 0; y < NodesNumberY; y++)
{
GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
cube.transform.localScale = new Vector3(4, 1, 4);
cube.transform.position = new Vector3(x * 5, 0, y * 5);
}
}
}
private void OnGUI()
{
if (GUILayout.Button("Generate Nodes"))
{
NodesNumberY = NodesNumberX;
Generate();
}
}
}
When i attach the script to a gameobject i want to see in the script in the inspector:
The OnGui add the button to the game screen when running the game.
But i want to add the button to the Inspector for example like the button Add Component. This kind of button.