Hello i want to add more than 1 tag in my if else statement below [if (hit.transform.gameObject.tag.Equals("object"))] so how can i use AND operator to add more tags thanks here is my code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ToolTip : MonoBehaviour {
public RectTransform tooltip;
public Text tooltiptext;
public Vector2 offset;
public LayerMask lm;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
RaycastHit hit = new RaycastHit();
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit, lm))
{
if (hit.transform.gameObject.tag.Equals("object"))
{
tooltip.gameObject.SetActive(true);
tooltiptext.text = hit.transform.name;
tooltip.position = new Vector3(Input.mousePosition.x + offset.x,
Input.mousePosition.y + offset.y);
}
}
else
{
tooltip.gameObject.SetActive(false);
tooltiptext.text = null;
}
}
}
Aucun commentaire:
Enregistrer un commentaire