Log in or register to post comments

Fix Error Collider

July 29, 2016 - 1:39pm #1

Hi, i need a help...

 

script name: VideoPlaybackController.cs

have a error, i no know solve this. UnityEngine.Component.collider is obsolete

 

 

private VideoPlaybackBehaviour PickVideo(Vector3 screenPoint)
{
  VideoPlaybackBehaviour[] videos = (VideoPlaybackBehaviour[])
   FindObjectsOfType(typeof(VideoPlaybackBehaviour));

  Ray ray = Camera.main.ScreenPointToRay(screenPoint);
  RaycastHit hit = new RaycastHit();

  foreach (VideoPlaybackBehaviour video in videos)
  {
   if (video.collider.Raycast(ray, out hit, 10000))
   {
    return video;
   }
  }

  return null;
}

 

Thanks. Sorry my english...

 

 

Fix Error Collider

August 17, 2017 - 2:13am #2

 

if (video.collider.Raycast(ray, out hit, 10000))

 

Replace with below one

 

if (video.GetComponent<Collider>().Raycast(ray, out hit, 10000))

Log in or register to post comments