Renderer Not Defined?

Hey guys, this is the code for my player.cs:


using UnityEngine;
using System.Collections;

public class Player : MonoBehaviour {

public float JumpHeight = 5;
public SpriteRenderer sRenderer;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {


}

public void Jump()
{
	if (GeometryUtility.TestPlanesAABB(GeometryUtility.CalculateFrustumPlanes (Camera.main).sRenderer.bounds)) 
	{
		rigidbody2D.velocity = new Vector2(0,JumpHeight);
	}
}
}

This is the error I get: Type UnityEngine.Plane[]' does not contain a definition for sRenderer’ and no extension method sRenderer' of type UnityEngine.Plane’ could be found (are you missing a using directive or an assembly reference?)

I can’t seem to figure out what I did wrong :c. Some help would be appreciated.

Ab

You might find it easier to spot your mistakes by separating complex functions into sub-steps. The problem is, exactly as the error message states, you’re trying to access a “sRenderer” member of the Planes object returned by CalculateFrustrumPlanes. Your code should read on that line:

if (GeometryUtility.TestPlanesAABB(GeometryUtility.CalculateFrustumPlanes (Camera.main), sRenderer.bounds))