current Material / texture size?!?!

So finally got my mesh hex map using UVs.

I am setting up my tile map and all the calculations and I go to look for the texture size so I can calculate the X of tiles in the texture… and I can’t seem to find how to do that!!!

I put in the material in the object, set the to Transparent/Cutout/Diffuse in the Inspector. But I haven’t been able to find any documentation that lets me know what the pixel dimensions are of the texture in the material?!?!

The only way I can do it apparently is by creating a public Texture2d and accessing it that way instead of using the one in the inspector.

renderer.material.mainTexture if you want the diffuse texture.

Yea there is something I am missing then…

I keep getting an error and I know its due to my novice programming skill with OOP.

I have the following

public class BuildHexMap : MonoBehaviour
{
     	void Start ()
	{
		BuildMesh ();
	}

	void BuildMesh () 
	{
		static Vector3 HexCenterCalc(int fHexX, int fHexY)
		{
		}
		class TilePos
		{
			float u(int fTileNum)
			{
				return uPosition;
			}
			float v(int fTileNum)
			{
				return vPosition;
			}
		}
	}
}

In TilePos.u and TilePos.v I need to know the renderer.material.mainTexture width and height so I can return the proper UV coordinates,

I keep getting this error.

error CS0038: Cannot access a nonstatic member of outer type UnityEngine.Component' via nested type BuildHexMap.TilePos’

BTW I really appreciate the help from everyone. I hope one day to give back when I know this material.

Is that the actual code? Why do you have a static method and a class inside another method?

Because I have no clue what I’m doing yet? Still getting use to OOP. I’m a procedural programmer. But you made me realize something.