#Creating SO & GO in editor
1 messages · Page 1 of 1 (latest)
private static void CreateWorldTilemap(string strID, Vector2Int vTilemapSize)
{
GameObject goTilemapWorldCurrent = new GameObject(strID);
ScriptableObject soTilemapWorldCurrent = new soTilemap(strID, vTilemapSize.x, vTilemapSize.y);
Component ScriptAdded = goTilemapWorldCurrent.AddComponent(typeof(MonoScript));
}
private void OnGUI()
{
EditorGUILayout.PrefixLabel("Editor ID: ");
string strID = EditorGUILayout.TextField("");
Vector2Int vTilemapSize = EditorGUILayout.Vector2IntField("Tilemap Size", new Vector2Int (1, 1));
if (GUI.Button(new Rect(60, 120, 200, 80), "Create World Tilemap"))
{
Debug.Log("Clicked!");
CreateWorldTilemap(strID, vTilemapSize);
}
}```
This is the wee snippet of code I have so far
...Ew. Looks awful in the thread view. https://pastebin.com/2BC71rUe
Pastebin
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Component ScriptAdded = goTilemapWorldCurrent.AddComponent(typeof(MonoScript)); Passing MonoScript here throws an error. It's not a component type.
What do?