Object position x = to another objects x position.

I have looked around an I am still a bit new to using “position” as I have not really needed to use it before in things I have coded.

I am trying to make the objects x position = to another objects x position.

Here is my scrpt C#

using UnityEngine;
using System.Collections;

public class InLine : MonoBehaviour {

	public GameObject Player;
	public GameObject Me;

	void Update () {
		Player.position = new Vector3 (transform.position.x, transform.position.y, transform.position.z);
		Me.position = new Vector3 (Player.x, transform.position.y, transform.position.z);
		}
	}

I get the issues: Vector 3 issues float, float, float.
Gameobject has no definition for position
and GameObject has no definition for x or extensions of w.e something along those lines.

Any help I would be very grateful.

Thank you,

Position is a member (or property) of the Transform class.

The variable x is a member (or property) of a transform's position.

To reference the x-value of the position of a transform, you do this:

var otherThing  :  GameObject;

function Update ()
{
    gameObject.transform.position.x = otherThing.transform.position.x;
}

Or something like that...

In this case gameObject.transform.position means the position of the transform of the game object that this script is attached to. In other words, you shouldn't need the variable named Me.

I usually work with Transforms rather than GameObjects, but I think it works like that.

Also, variable names should begin with lowercase letters. Capital letters are used for classes, functions, namespaces, etc...

Thank you to the person who knows the difference between JavaScript and C#!