- Home /
This question was
closed Jul 01, 2015 at 10:38 AM by
Graham-Dunnett for the following reason:
Duplicate Question
namespace UnityStandardAssets.Characters.FirstPerson
I can't get any script component from other object. I got this error:
error CS0246: The type or namespace name `MyScript' could not be found. Are you missing a using directive or an assembly reference?
I'm using default FirstPersonController.cs.
namespace UnityStandardAssets.Characters.FirstPerson
{
[RequireComponent(typeof (CharacterController))]
[RequireComponent(typeof (AudioSource))]
public class FirstPersonController : MonoBehaviour
{
private GameObject ObjController;
private void Start()
{
ObjController = GameObject.Find("ObjController");
float MyVar = ObjController.GetComponent<MyScript>().MyVarf;
}
}
}
Comment
Please read the many questions and answers about cs0246. If none of them solve your problem, please post a question that explains the very different problem you have. I tagged your question for you.