How do I get a pointer to this script from a trigger
So I have a ledge climbing script and I need to get a reference to the ThirdPersonController script that comes with Unity's Start Asset package. But whenever I reference the script from my trigger the compiler will not compile saying it can't find it? Anyone solved this problem or had it? Am I missing something? I've looked all over for an answer and even poured through the code myself but can't figure it out. Thanks for any help in this matter.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Ledge : MonoBehaviour
{
[SerializeField]
private Transform _grabPosition;
private void OnTriggerEnter(Collider other)
{
if (other.tag == "LedgeGrab")
{
ThirdPersonController player = other.gameObject.GetComponentInParent<ThirdPersonController>();
if (player != null)
{
if (_grabPosition != null)
{
ThirdPersonController.GrabLedge(_grabPosition.position);
}
}
}
}
}
Your answer
Follow this Question
Related Questions
Controller Rotation returns to Zero when there is no movement. 0 Answers
Need Help With My Script And Animator. 0 Answers
The code does not work in unity 0 Answers
Why can I not pick up my moving/wandering objects yet I can pick up those that stay in one place? 0 Answers
,How to rotate an object and keep its rotation onto the world when its rotated? 0 Answers