Can you help me with my Unity proyect? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 6

Can you help me with my Unity proyect?

I'm making a game as a final project in Unity. (C#) I have everything fine, just one doubt. there is a scene where there are signs and i need to add caption to interaction. What should I put? This is my code: public class Ray : MonoBehaviour { RaycastHit hit; public float rango; // Start is called before the first frame update void Start() { } // Update is called once per frame void FixedUpdate() { if (Input.GetMouseButtonDown(0)) { if (Physics.Raycast(transform.position, transform.forward, out hit, rango)) { if (hit.transform.tag == "Letrero") { Debug.DrawRay(transform.position, transform.TransformDirection(Vector3.forward) * hit.distance,Color.yellow); print("Pegó"); } else { Debug.DrawRay(transform.position, transform.TransformDirection(Vector3.forward) * 1000,Color.white); print("No pegó"); } } } } private void OnDrawGizmos() { Gizmos.color = Color.red; Gizmos.DrawRay(Camera.main.transform.position, Camera.main.transform.forward * rango); } }

25th Nov 2020, 2:01 AM
Francisco De Jesus Aguirre Sarabia
Francisco De Jesus Aguirre Sarabia - avatar
1 Respuesta
0
Try asking somewhere else
29th Nov 2020, 9:43 PM
OverdrivedProgrammer