Click here to Skip to main content
15,888,286 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I use this code in my Unity game, and i get this error:

are you missing a using directive or an assembly reference?

I don't know what to do. Can anyone help me? Here's my code:
C#
using UnityEngine;
using System.Collections;

public class WhiteFadeTrigger : MonoBehaviour {

	public GameObject FadeWhiteObject;


	void OnTriggerEnter(Collider other)
	{
		
		if (other.gameObject.name == "Player")
		{
			Debug.Log("Hit");
			GameObject.Find("FadeWhiteObject").GetComponent("WhiteFade").enabled = true;
		}
	}
}
Posted
Updated 7-Mar-15 16:07pm
v2
Comments
Sergey Alexandrovich Kryukov 7-Mar-15 23:21pm    
What to do? Before writing games, learn at least the basics of what .NET does. First of all, read on how assemblies are used and, in particular, referenced.
—SA

1 solution

You are obviously missing a using or assembly reference. Look at the line where the message occurs and ensure that you have included the reference and using statement for that class's assembly. If you do not understand what that means then check out https://msdn.microsoft.com/en-us/library/sf0df423.aspx[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900