Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - fenixn0909

Pages: [1]
1
Support / Re: Can't access to tk2dTileMap.renderData from Prefabs
« on: June 10, 2015, 02:35:36 pm »
It works and another lesson learnt, thank you very much for point it out! you saved my day!  :D

2
Support / Can't access to tk2dTileMap.renderData from Prefabs
« on: June 10, 2015, 03:14:49 am »
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!

Pages: [1]