- Home /
 
               Question by 
               IconicJK · Jul 17, 2020 at 10:58 AM · 
                tilemapgridtilegrid based game  
              
 
              How can I compare two tilemaps by color?
I have two grids that contains different tilemap and I want to compare those two tilemaps by color is it possible? Can I know if two grids' tilemap's color are same?
               Comment
              
 
               
              Answer by ilagef · Jul 17, 2020 at 11:24 AM
Try this:
 public bool IsSameColor(Color c1, Color c2){
     return c1.r == c2.r && c1.g == c2.g && c1.b == c2.b && c1.a == c2.a
     }
Calling the function:
 IsSameColor(tile1.GetComponent<Material>().color, tile2.GetComponent<Material>().color);
- make sure that the tiles have a material 
Your answer
 
 
             Follow this Question
Related Questions
How to stack components on a Tile/Tilemap 0 Answers
Grid and or Tile System 0 Answers
Hexagonal grid with 120 degree angles 1 Answer
Creating an isometric/hex-based game system 1 Answer
How can I use the GridBrush in Unity at runtime in the game? 3 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                