Question by 
               Reality-Gaming-Studio · Dec 04, 2015 at 12:01 PM · 
                androidiphone  
              
 
              Error with TouchControl.cs
Hi
I have this error on Unity 5.2.3:
Assets/Scripts/Controls/TouchControl.cs(34,79): error CS1061: Type UnityEngine.GameObject' does not contain a definition for collider' and no extension method collider' of type UnityEngine.GameObject' could be found (are you missing a using directive or an assembly reference?)
And the code what cause this error is:
 if( ControlInput.GetStringButton( j ).collider.Raycast( ray, out hit, Mathf.Infinity ) )
Whole code is:
 using UnityEngine;
 using System.Collections;
 
 public class TouchControl : MonoBehaviour
 {
 #if !UNITY_EDITOR && ( UNITY_IPHONE || UNITY_ANDROID )
     ControlInput ControlInput;
     bool[] StringChanges = new bool[ ControlInput.NumStrings ];
 
     //Use this for initialization
     void Start()
     {
         ControlInput = GetComponent<ControlInput>();
     }
 
     void Update()
     {
         for( int i = 0; i < ControlInput.NumStrings; ++i )
         {
             StringChanges[ i ] = false;
         }
 
         for( int i = 0; i < Input.touchCount; ++i )
         {
             Touch touch = Input.GetTouch( i );
 
             if( touch.phase == TouchPhase.Moved || touch.phase == TouchPhase.Stationary )
             {
                 Ray ray = Camera.main.ScreenPointToRay( touch.position );
                 RaycastHit hit;
 
                 for( int j = 0; j < ControlInput.NumStrings; ++j )
                 {
                     if( ControlInput.GetStringButton( j ).collider.Raycast( ray, out hit, Mathf.Infinity ) )
                     {
                         StringChanges[ j ] = true;
                     }
                 }
             }
         }
 
         for( int i = 0; i < ControlInput.NumStrings; ++i )
         {
             ControlInput.OnStringChange( i, StringChanges[ i ] );
         }
         
     }
 #endif
 }
Help me!
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Arshia001 · Dec 04, 2015 at 06:26 PM
Change collider to
GetComponent<Collider>()
The component getter properties were removed since Unity 5.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                