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
  4. Dismiss Notice

I am getting the error CS1513: expected Pls I really need help

Discussion in 'Scripting' started by SyloaK, Apr 27, 2021.

  1. SyloaK

    SyloaK

    Joined:
    Apr 26, 2021
    Posts:
    2
    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class PlayerCollision : MonoBehaviour
    4. {
    5.  
    6.     public PlayerMovement movement;
    7.  
    8.     void OnCollisionEnter(Collision collisionInfo)
    9.     {
    10.         if (collisionInfo.collider.tag == "Obstacle")
    11.         {
    12.             Transform.position = 0, 1, 0;
    13.         }
    14.     }
    15. }
     
  2. TheNightglow

    TheNightglow

    Joined:
    Oct 1, 2018
    Posts:
    201
    the error id is the least relevant information of an error

    the error additionally tells you where and what the problem is,
    in your case your error probably tells you that something is wrong in line 12....

    in anyway this line here does not follow c# syntax in any way:

    Transform.position = 0, 1, 0;

    I assume what you are trying to do is:

    transform.position = new Vector3(0, 1, 0);
     
  3. SyloaK

    SyloaK

    Joined:
    Apr 26, 2021
    Posts:
    2
    Thanks so much! I'm a beginner, so i don't really know much about unity and how to script.
     
    mopthrow likes this.