Assets/CArSmoothFollow.cs(40,68): error CS0246: The type or namespace name `ExampleGame_Game' could not be found.
Hey! iam trying to fill a public Transform with a Gameobject of another script.
here is the target script which
using UnityEngine;
using System.Collections;
using LE_LevelEditor.Core;
public class CArSmoothFollow : MonoBehaviour {
public Transform target;
void Start () {
target = GameObject.Find("GameLogic").GetComponent<ExampleGame_Game>().TestCar.transform;
}
and this is the script whit the gameobject i want to adress (inside a Gameobject called "GameLogic"):
using UnityEngine;
using LE_LevelEditor.Core;
using System.Collections;
namespace LE_LevelEditor.Example
{
public class ExampleGame_Game : MonoBehaviour
{
public GameObject TestCar;
.
.
.
but all i get is the error: Assets/CArSmoothFollow.cs(40,68): error CS0246: The type or namespace name `ExampleGame_Game' could not be found. Are you missing a using directive or an assembly reference?
Answer by fffMalzbier · Dec 07, 2015 at 03:01 PM
Your class ExampleGame_Game is in a namsepace called LE_LevelEditor.Example If you like to access ExampleGame_Game from the CArSmoothFollow class you have to declare that you like to use the namespace of LE_LevelEditor.Example.
You would need to add the following to your CArSmoothFollow class file:
using LE_LevelEditor.Example;
Your answer
Follow this Question
Related Questions
Car movement left or right 0 Answers
Cannot properly access player position 1 Answer
How to get the position of a gameObject based on its index in an array? 0 Answers
If you want to destroy the game object, please call 'Destroy' on the game object instead. 1 Answer
How To Make An Object Appear In Front Of Player Without Cloning? 1 Answer