so, im very very new to this, im trying to do a simple platformer and the code im trying to make is a simple small piece of code that I can attach to trigger objects throughout the level so that as the player character moves through them it changes to position of the camera. this... was a harder feat than making the character move, it turned out. the piece im having trouble with is the bolded bit.
using UnityEngine;
using System.Collections;
public class Environmenttriggercamera : MonoBehaviour
{
public CameraControl windowOffset;
public GameObject Player;
void Start ()
{
GetComponent ();
}
void OnTriggerEnter (Collision Collider)
{
if (Collider.gameObject.GetComponent() == LayerMask.NameToLayer("Player"))
{
**windowOffset = new Vector2 (9,-3);**
}
}
}
the window offset in the camera control script is this right here:
public Vector2 windowOffset = new Vector2(-9,-3);
And no matter what I do it keeps giving me the error "Cannot implicitly convert type 'unityEngine.Vector2' to 'cameracontrol'". I've worked through problems in other parts of this project before, but i've always managed to figure out a solution in the end. this, however, has turned into a straight up roadblock for the past week. can anyone help?
↧