I just want the object to identify surrounding objects inside a collider and i thought of this script (C Sharp) to do so:
using UnityEngine;
using System.Collections;
public class generatorScript : MonoBehaviour {
Transform structureLink;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnCollisionEnter (Collision[] hit) {
for (int i = 0; i < hit.Length; i++){
if (hit*.transform.tag =="structure"){*
_ structureLink = hit*.transform;*_
* }*
* }*
* }*
}
anyway there is a warning that says: Assets/generatorScript.cs(6,19): warning CS0414: The private field `generatorScript.structureLink’ is assigned but its value is never used
and an error that says:Script error: OnCollisionEnter
This message parameter has to be of type: Collision
The message will be ignored.
any help is much apriciated thank you