MenuButton.Start C# (CSharp) Méthode

Start() public méthode

Initializes the MenuButton.
public Start ( ) : void
Résultat void
    void Start()
    {
        float size = Camera.main.WorldToScreenPoint(new Vector3(1, 0, 0)).x -
                     Camera.main.WorldToScreenPoint(new Vector3(0, 0, 0)).x;
        this.GetComponent<BoxCollider2D>().size = new Vector2(size, size);

        _elementCountText = GameObject.Find(GetTextName()).GetComponent<Text>();

        _sprite = this.GetComponent<Image>();
        if (ElementCount == 0)
        {
            SetOffSprite();
            return;
        }

        SetOnSprite();
        SpawnUIDraggableElement();
    }