get layermask from gameobject layer unity
LayerMask.GetMask(gameObject.layer);
get layermask from gameobject layer unity
LayerMask.GetMask(gameObject.layer);
layermask in unity
} void FixedUpdate()
{
Transform transform = Camera.main.transform; if (Input.GetKeyUp("space"))
{
// Check for a Wall.
LayerMask mask = LayerMask.GetMask("Wall"); // Check if a Wall is hit.
if (Physics.Raycast(transform.position, transform.forward, 20.0f, mask))
{
Debug.Log("Fired and hit a wall");
}
}
}
}
unity get layermask
int layer = (int)Mathf.Log(uninteractablePartsLayer.value, 2);
Debug.Log("uninteractablePartsLayer "+LayerMask.LayerToName(layer));
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us