Assets/Scripts/GunController.cs(8,9): error CS0246: The type or namespace name `Gun' could not be found. Are you missing a using directive or an assembly reference?

using UnityEngine;
using System.Collections;

public class GunController : MonoBehaviour {

public Transform weaponHold;
*ERROR*Gun equippedGun;

*ERROR*public void EquipGun(Gun gunToEquip) {
	if (equippedGun != null) {
		Destroy(equippedGun.*ERROR*gameObject);
	}
	equippedGun = Instantiate (gunToEquip);

}

}

If your question is answered, don't forget to accept the answer, <img src="https://dl.dropboxusercontent.com/u/7761356/UnityAnswers/Images/HowToAcceptAnAnswer.PNG">

2 Answers

2

Check if class Gun exists and if Gun class name is the same in script and project.

yes the same, there is nothing superfluous

Well that means that unity doesn’t find the Gun script, maybe you mispelled it or you placed it in an other namespace,.

Can provide a bit more information so we can help more?

nothing else, write the code from scratch