Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

All compiler errors have to be fixed before you can enter playmode!

Discussion in 'Scripting' started by Devidze, Jul 11, 2015.

  1. Devidze

    Devidze

    Joined:
    Jul 10, 2015
    Posts:
    6
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class ball : MonoBehaviour {
    5.    
    6.     public float ballVelocity = 3000;
    7.    
    8.     Rigidbody rb;
    9.     bool isPlay;
    10.     int randInt;
    11.    
    12.     void Awake ()
    13.     {
    14.         rb = gameObject.GetComponent<Rigidbody>();
    15.         randInt = Random.Range (1,3);
    16.     }
    17.    
    18.     void Update ()
    19.     {
    20.         if(Input.GetMouseButton(0) == true && isPlay == false)
    21.         {
    22.             Transform.parent = null;
    23.             isPlay = true;
    24.             rb.isKinematic = false;
    25.             if(randInt == 1)
    26.             {
    27.                 rb.AddForce(new Vector3(ballvelocity, ballvelocity,0));
    28.             }
    29.             if(randInt == 2)
    30.             {
    31.                 rb.AddForce(new Vector3(-ballvelocity,-ballvelocity,0));
    32.             }
    33.         }
    34.     }
    35. }
    Hello guys i have another problem with my project, i wrote all the scripts but i cant even enter a playmode. so i checked everything but without any difference so please help if you can here is some pictures of my work:
     

    Attached Files:

    Last edited: Jul 11, 2015
  2. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
  3. BPPHarv

    BPPHarv

    Joined:
    Jun 9, 2012
    Posts:
    318
    Line 22 is your error.
    You are trying redefe the base prototype Transform parent value. This is not possible. You want this object's transform instead so change to : (note small t not cap T)
    Code (csharp):
    1. transform.parent=null;
     
  4. Devidze

    Devidze

    Joined:
    Jul 10, 2015
    Posts:
    6
    yes i fixed this but still not working
     
  5. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    What do you mean? Is it still not compiling or is it compiling and running but not doing what you expected?