- Home /
 
               Question by 
               Mr_Inkoqnito · Jan 21, 2015 at 06:15 PM · 
                sizeboxcollider2d  
              
 
              Why is it working in JS but not C#
Hello all,
i have been trying to resize a boxcollider2d with code and it works with js but not with c# what am i doing wrong? i have the codes:
C#
 using UnityEngine;
 using System.Collections;
 
 public class gameSetup : MonoBehaviour {
 
     public Camera mainCam;
 
     public BoxCollider2D topWall;
 
 
 
     
     // Update is called once per frame
     void update () {
 
 
         topWall.size = new Vector2 (mainCam.ScreenToWorldPoint (new Vector3 (Screen.width * 2f, 0f, 0f)).x, 1f);
         topWall.center = new Vector2 (0f, mainCam.ScreenToWorldPoint (new Vector3 (0f, Screen.height, 0f)).y + 0.5f);
 
 
     
     }
 }
JS
 #pragma strict
 
 //Reference the camera
 var mainCam : Camera;
 
 //Reference the colliders we are going to adjust
 var topWall : BoxCollider2D;
 
 
 function Update () {
 
 
 
 
 
     //Move each wall to its edge location:
     topWall.size = new Vector2 (mainCam.ScreenToWorldPoint (new Vector3 (Screen.width * 2f, 0f, 0f)).x, 1f);
     topWall.center = new Vector2 (0f, mainCam.ScreenToWorldPoint (new Vector3 ( 0f, Screen.height, 0f)).y + 0.5f);
     
     
 
 }
And i have dragged camera and wall to the correct variables
Kind regards
Isak
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Eric5h5 · Jan 21, 2015 at 06:25 PM
There is no "update" function; you mean "Update". All code is case-sensitive. You should always use the standard conventions of uppercase for class and method names, and lowercase for variables.
Haha it was that easy, thanks a lot. Now i can continue.
Your answer
 
 
             Follow this Question
Related Questions
Object size changing issue (w/ box collider) 1 Answer
How to check if one object is bigger than another? 1 Answer
What is the game object measurement unit? 2 Answers
Dimensions of a Cube 2 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                