I am trying to call another function in another script for an editor layout script.

I am creating a button in the editor GUI and am having trouble calling a function in another script. For reference the other script is titled meshGen and the function is called buildMesh.

The error is with the regen.buildmesh command and for some reason I cannot understand the reason. (not much programming experience here)

Also before its mentioned not sure if UnityEngine or System.Collections were going to be used so I left them for posterity purposes.

EDIT: The error is with line 13.

using UnityEditor;
using UnityEngine;
using System.Collections;

[CustomEditor(typeof(meshGen))]

public class TileMapRegen : Editor {

	public override void OnInspectorGUI() {
		base.OnInspectorGUI();
		
		if(GUILayout.Button("Regenerate")){
			meshGen regen = meshGen(target);
			regen.buildMesh;
		}
	}
}

Please have a look at catlikecoding’s excellent tutorial on editor scripts. It starts out with decribing how to create meshes, but soon enough it goes into a lot of very useful editor code.

Below is an example of how catlike does things.

Note : you should follow conventions, class and method names start with uppercase, variables use camelCase. Also, you’re forgetting the () after regen.buildMesh.

private SerializedObject serializedObj;

void OnEnable()
{
     serializedObj = new SerializedObject(target);
}
public override void OnInspectorGUI ()
{
    serializedObj.Update();
    meshGen regen = (meshGen)target;
    regen.buildMesh();
}