cs0117 error in infinite platform script
HI i'm new in unity
I'm trying to make a infinite platform script but I got the following error for this script:
error CS0117: UnityEngine.GameObject' does not contain a definition for
GetComponnent'
using UnityEngine;
using System.Collections;
public class test : MonoBehaviour {
public GameObject thePlatform;
public Transform generationPoint;
public float distanceBetween;
private float platformWidth;
// Use this for initialization
void Start () {
platformWidth = thePlatform.GetComponnent<BoxCollider2D>().size.x;
}
// Update is called once per frame
void Update () {
}
}
I don't understand why i got this error and how can i fix-it?
can you help me guys?
thank for your time
Answer by Namey5 · Sep 14, 2016 at 09:59 PM
"GetComponnent" is a typographical error. The actual function you are trying to use is "GetComponent".
Answer by oanto80 · Sep 14, 2016 at 06:24 PM
I alsaw get this error... error CS1061: Type UnityEngine.GameObject' does not contain a definition for
GetComponnent' and no extension method GetComponnent' of type
UnityEngine.GameObject' could be found (are you missing a using directive or an assembly reference?
Your answer
![](https://koobas.hobune.stream/wayback/20220612092817im_/https://answers.unity.com/themes/thub/images/avi.jpg)