ello
New Member
Posts: 1
|
Post by ello on Jul 2, 2023 17:20:56 GMT
,Hey I have tried using the chat example with TextMesh pro all things being equal and it fails to size it correctly. Even when sizing using that example and standard text, it still misses the calculation of the text. Is there a way to just size by content or fix this example using Text Mesh Pro? thanks! great library btw!
|
|
|
Post by echo17 on Jul 3, 2023 17:28:53 GMT
Thanks for the kind words.
If you are referring to Demo 16, then that demo uses a rough estimation to calculate the size of the cell based on a character width and height that you pass in the inspector. Try changing the character width and height values in the inspector for the Chat controller component.
You can also adjust the algorithm that calculates the size needed if you like. Take a look at the method "AddNewRow" in the Chat.cs script. You'll see where the character width and height are being used to roughly determine how much space is being taken up.
You can also use Unity's content size fitter component to get an exact size. Take a look at Demo 8 for an example of this. Unfortunately, to use the content size fitter all content must be available for Unity to do the calculations. That means you will have to create all the cells like in Demo 8, even the ones that aren't visible. If you have a lot of cells this is going to probably be unusable. If you just have a small set of cells, then that will work nicely.
|
|