possible to add to a texture through code?

Hey guys, I have a hexagon gridmap for my game, i want it to default to invisible, but then have a toggle button to change the material to outline the hexagons. I have managed to do this… but even on my smallest map there is 2500 hexagons… so there’s a bit of a delay between pressing the button and them disappearing.

So i thought, the hexagons are parented to a grid object… would it be possible for me to create a texture for the hexgrid based on all the hexagon textures? Similar to how you might create a mesh out of the meshes of seperate objects that already exist.

I’m not expecting there to be… just very hopeful, 'cause changing the hexgrid material from opaque to transparent and back would take a fraction of the time of doing it for all hexagons.

Alternatively does any one know of another way i can cut out the delay time?

Thanks all.

1 Answer

1

I have managed to find a solution to this, went out to walk the dogs and get some fresh air, and a solution so simple i’m amazed it didn’t occur to me before presented itself.

To any trying to do something similar this is what i did:

Duplicated hexagon prefab, set the duplicate as a child to the original, turn off the renderer of the parent, set the child to be in a separate layer. Use the button to toggle that layer on and off from the cameras culling mask =). Hope that helps some one.