csharp unity get lines

Code Example - csharp unity get lines

                
                        //Gameobject has to be active (Displayed)
//otherwise it will return the value from the last active frame (0)!
Canvas.ForceUpdateCanvases();
[Your Text Compontent].cachedTextGenerator.lineCount;