I'm using the Unity Standard Asset FirstPersonController asset in my game. I am attempting to access a script that is attached to a child that I've put into the "Player" GameObject. So the setup is as follows:
.>Player (With "FirstPersonController.cs" script attached that I'm having trouble with)
.>>FirstPersonCharacter
.>>HandHeldItem
.>>>Node_Handle
.>>>>Canvas (UI Canvas)
.>>>>>IDRangePlaceHolder (With "TextBehavior3.cs" script attached that I am trying to send info to)
I'm new to programming, so it's probably a simple problem to correct, and I think it has something to do with the namespace called out in the FirstPersonController.cs script.
using UnityEngine;
using System.Collections;
using System;
using UnityStandardAssets.CrossPlatformInput;
using UnityStandardAssets.Utility;
using Random = UnityEngine.Random;
namespace UnityStandardAssets.Characters.FirstPerson
{
[RequireComponent(typeof (CharacterController))]
[RequireComponent(typeof (AudioSource))]
public class FirstPersonController : MonoBehaviour
{
void Start()
{
GameObject idrDisplay = GameObject.Find("IDRangePlaceHolder");
TextBehavior3 idrUpdate = idrDisplay.GetComponent();
}
It keeps putting "TextBehavior3" in red text, but this is copied and pasted from another script where it's working just fine, but that other script does not have a namespace called out, so that's why I'm thinking that's what is causing the problem.
↧