After that's finished, the same happens with LateUpdate methods. void Awake () What is the difference between Update and LateUpdate?Įach frame, the Update methods of enabled components are invoked at some point, in arbitrary order. Put the creation of the cells in their own method as well, to keep Awake tidy. public int width = 6 // public int height = 6 int cellCountX, cellCountZ Specifying size in chunks.Īdjust Awake so the cell counts are derived from the chunk counts before they are needed. Now it's clear when we're dealing with chunk or cell counts. Use your editor to rename all occurrences of these variables in one go. We'll also rename these fields to cellCountX and cellCountZ. We'll still use width and height, but they should become private. public int chunkCountX = 4, chunkCountZ = 3 Set it to 4 by 3 chunks by default, for a total of 12 chunks and 300 cells. So let's change HexGrid so it defines its size in chunks instead of individual cells. Now we can no longer use any size for our grid, we have to use multiples of the chunk size. The pragmatic approach is to just pick a size and fine-tune later. But smaller chunks work better with frustum culling, which leads to fewer triangles being drawn. Using larger chunks means that you'll have fewer but larger meshes.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |