Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

319
Views
Pasar el cursor sobre un botón también afecta a otro botón

Tengo dos botones así: ingrese la descripción de la imagen aquí

Estoy usando DOTween para que cuando pase el mouse sobre el botón, se resalte al agrandarse ligeramente y se interponga para que se vea suave. Sin embargo, tengo dos secuencias de comandos separadas adjuntas para cada botón que hacen exactamente lo mismo, pero cuando paso el mouse sobre uno de los botones, el otro botón también se agranda. Intenté usar los botones debajo del mismo lienzo que no funcionó. Entonces intenté usar dos lienzos para botones separados y sigue siendo el mismo problema. Se ve así: https://vimeo.com/user105553995/review/517200220/41fbe8d619

Mi código está en diferentes secuencias de comandos para cada botón, pero es exactamente el mismo:

 using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; using DG.Tweening; public class OtherButton : MonoBehaviour { // Start is called before the first frame update private Vector3 defaultScale; // Start is called before the first frame update void Start() { defaultScale = this.transform.localScale; } // Update is called once per frame void Update() { WhilePointerHover(); } private void WhilePointerHover() { if (EventSystem.current.IsPointerOverGameObject()) { Vector3 enlarge = defaultScale*1.2f; this.transform.DOScale(enlarge, 0.05f); Debug.Log(this.gameObject.name); } else this.transform.localScale = defaultScale; } }

¡Cualquier ayuda es apreciada!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

El código verifica si está sobre algún objeto de la interfaz de usuario, por lo que cualquier secuencia de comandos reaccionará.

Debe usar https://docs.unity3d.com/2019.1/Documentation/ScriptReference/UI.Selectable.OnPointerEnter.html

Y

https://docs.unity3d.com/2019.1/Documentation/ScriptReference/UI.Selectable.OnPointerExit.html

Por lo tanto, solo reaccionará al objeto al que está unido. Tenga en cuenta que el componente Imagen o Botón debe estar en el mismo objeto.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!