I added Post processing asset to my project for underwater.
I added camera trigger sphere collider.
Water has tag Water.
Water has trigger collider box
Camera has scipt CameraLeavingWater.cs
So when camera comes in contact with collider with a tag "Water" it disables PostProcessLayer.cs which is component to Camera.
Well.... it should..
Here is my script.
public class CameraLeavingWater : MonoBehaviour {
void OnTriggerEnter(Collider other)
{
if(other.GameObject.tag == "Water")
{
this.GetComponent.Enabled = true;
}
}
/*
void OnTriggerExit(Collider other)
{
if(other.GameObject.tag == "Water")
{
this.GetComponent.Enabled = false;
}
}*/
}
what excatly am i doing wrong? Im getting 4 errors.
error 1 and 3
`(11,12): error CS1061: Type 'UnityEngine.Collider' does not contain a definition for 'GameObject' and no extension method 'GameObject' of type 'UnityEngine.Collider' could be found. Are you missing an assembly reference?`
error 2 and 4
`(13,9): error CS0119: Expression denotes a 'method group', where a 'variable', 'value' or 'type' was expected`
↧