Calling 2 objects into script for onCollisionEnter?

Basically have a moving platform that is working great,
and now I am trying to get a trigger going so that when the player
enters it then the platform starts its animation of going back and forth as it does.
I want to be able to do this through the platform script to keep things more modular,
but cannot figure out how the right way to use the two objects of player and P3Trig
in conjuction with OnTriggerEnter2D. The following is my failed attempt:

using UnityEngine;
using System.Collections;

public class Pmove3 : MonoBehaviour {
public GameObject Player;
	public GameObject P3Trig;
	if (Player){
	void OnTriggerEnter2D(Collider2D col)
		if(col.gameObject.tag == "P3Trig")
			moveStart = true;
			Pmove3Control ("Start");

Thanks a million! Look forward to paying the help forward here.

If the answer to the above comment is true, you can get the ‘mover’ script like so - replace “Mover” with the name of the script doing the moving.

Mover moveScript = GetComponent.<Mover>  ();

If the script is on a different object then the trigger, you’ll need to get the platform object first. you’re better off putting the trigger on the same object though, so you don’t need to specify the platform.

gameObject oPlatform = Find.GameObject ("Platform");
Mover moveScript = oPlatform.GetComponent.<Mover>  ();

with that you can set a variable or call a function on that script like so

moveScript.Move = true;



just make sure the function and variables are set to public. Also, i haven’t compiled this, so you might need to modify it a bit to work