Hi all,
I have some tilemap Prefab store in Resource folder, I would like to reparent the renderDatas to WorldMap, here is the code:
GameObject WorldMap;
GameObject tk2dTileMapPrefab = (Resources.Load("Prefabs/tileMapArea1") as GameObject);
Instantiate (tk2dTileMapPrefab, new Vector3 (0, 0, 0), Quaternion.identity);
tk2dTileMap tilemap = tk2dTileMapPrefab.GetComponent<tk2dTileMap>() as tk2dTileMap;
tilemap.renderData.transform.parent = WorldMap.transform;
there is no compiling error, but when the game start to run, the error message shows up:
UnassignedReferenceException: The variable renderData of tk2dTileMap has not been assigned.
You probably need to assign the renderData variable of the tk2dTileMap script in the inspector.
Is this a bug? or am I missed something to make this work?
Thanks in advanced!