public tk2dTileMap tileMap;
public tk2dSpriteCollectionData thingYouWantToChangeItTo;
tileMap.SpriteCollectionInst.materialInst[0].mainTexture = thingYouWantToChangeItTo.material.mainTexture;
Hi! I tried doing the above to change the tilemap at runtime but couldn't succeed. I keep getting this message:
UnassignedReferenceException: The variable material of 'tk2dSpriteCollectionData' has not been assigned.
You probably need to assign the material variable of the tk2dSpriteCollectionData script in the inspector.
UnityEngine.Material.GetTexture (System.String propertyName) (at C:/BuildAgent/work/d3d49558e4d408f4/artifacts/EditorGenerated/ShaderBindings.cs:220)
UnityEngine.Material.get_mainTexture () (at C:/BuildAgent/work/d3d49558e4d408f4/artifacts/EditorGenerated/ShaderBindings.cs:166)
...
When the code calls this line:
tileMap.SpriteCollectionInst.materialInsts[0].mainTexture = black.material.mainTexture;
What can I do? I also need to change the tiles at runtime.
While in the topic, is it possible to apply shaders to one layer?
Thanks in advance!