Getting Collision Position to print to console

Im just to trying to get a XYZ position to print in console when my guy jumps into Collider trigger.

Unity tells me that the “Name” set does not exist. which doesnt make a whole lot of since since it shouldnt be seeing it as a name???

Here’s what im running.

using UnityEngine;
using System.Collections;

class ConsoleLogVectorPos : MonoBehaviour {
	float X = 0;
	float Y = 0;
	float Z = 0;
	
	Vector3 Point = new Vector3();

    void OnTriggerStay(Collider other) {
		
        if (other)
			set(float_X, float_Y, float_Z);
            Debug.Log("Collision of X,Y,Z is: ");
        
    }
	void OnTriggerExit(Collider other) {
	
		Debug.Log("Bye");
	}
}

The compiler interprets the above as “set” being a function which is to be called if the Collider called “other” exists. But there is no function called “set” anywhere. You didn’t define one, and Unity doesn’t have a built-in one. So the compiler cannot find a function called “set” to call, therefore it reports that the name of this function doesn’t exist anywhere.

To fix it, either define a function called set, or implement what you want in a different way.

Perhaps this code sample is closer to what you’re trying to achieve?

void OnTriggerStay(Collider other)
{
    Vector3 collisionPoint = other.ClosestPointOnBounds(transform.position);
    Debug.Log("Collision of X,Y,Z is: " + collisionPoint.ToString("F4"));
}