[Solved] how to get current zoom level from scene window

Bizhan Asks: how to get current zoom level from scene window
I want to show some label on some rect transforms using Handles.Label(). it shows the text with a default font size regardless of the zoom level in the scene window.

public class NodeWrapper : MonoBehaviour {

    public Node node;

    void OnDrawGizmos()
        Handles.Label(transform.position + new Vector3(-.9f, .5f), node.Name);
        Handles.Label(transform.position + new Vector3(-.9f, .4f), node.Info);

So when I zoom out in the scene window, the labels get closer and at some point they become unreadable. I want to show/hide some lines when zoom level changes. How can I achieve that? Is it possible to get the current zoom level of the scene?


PS. I’m developing a node editor for another game, I use scene window to create and serialize some objects. My target is only Scene window which uses 2D config.

enter image description here

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.