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

Expression denotes a type where a variable, value or method group was expected.

Discussion in 'Scripting' started by TwoTen, Jun 30, 2016.

  1. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    So I am working on moving the current game object (this.transform.position). to another game boject called SpawnPoint1.

    This is how I thought It would be done:
    this.transform.position = Vector3(SpawnPoint1.transform.position.x, SpawnPoint1.transform.position.y, SpawnPoint1.transform.position.z);

    C#.
    But it says the error seen in the title. Any Clues what the problem might be?
     
  2. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,731
    You missed out the new keyword

    transform.position = new Vector3(SpawnPoint1.transform.position.x, SpawnPoint1.transform.position.y, SpawnPoint1.transform.position.z);
     
    TwoTen likes this.
  3. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    Thanks alot man!
     
    Munchy2007 likes this.