is this possible to do in Unity Scripting?

Hi,

i have a cube in my scene then i have attache one script to that cube which is have the multiple raycast function left side raycast right side raycast and up wards but this three function not working properly. Really is this possible for doin unity scripting?

Thanks in Advance.

I don’t see how this isn’t possible.

What are you trying to achieve? What is not working? Did you try to debug your lines with Debug.Drawline and see where they are going?

this is my code i attached this to my cube. according from this code its raycasting right, left and top if any object reach its among any sides it should be do some function but its not working. What i want means i move this to any other object corresponding raycast should be work. But now its not.

RaycastHit hit;
		
		if(Physics.Raycast(transform.position, Vector3.right, out hit, 0.50f)){
			
			
				
				print("This is the right  raycst function");
			
			}
			
			else{
				
				
			}
				
		}
		
		else if(Physics.Raycast(transform.position, Vector3.left, out hit, 0.50f)){
			
			if(hit.collider.gameObject.tag == "Plane"){
				
				
				
				print("This is the left raycst function");
				
			}
			
			else{
				
				
			}
		}
//		
		else if(Physics.Raycast(transform.position, Vector3.up, out hit, 0.50f)){
			
			if(hit.collider){
				
				
				
				print("This is the up raycst function");
				
			}
			
			else{
                      }
				
		}
		
		else{
                      }

You asked the same question here and the answer was also given in that thread…

oops sorry i did not see that…