edited January 2015 in ORK Scripting
using UnityEngine;
using System.Collections;
using ORKFramework;

public class CameraMovement : MonoBehaviour {

Transform target;

void Start() {
}

void Update () {


GameObject player = ORK.Game.GetPlayer();

target.position = target.position + new Vector3 (0, 0, -10);

target = GameObject.Find ("Player").transform;

}
}
This is the script I'm currently trying to get working.

Unfortunately I keep getting this erorr: NullReferenceException: Object reference not set to an instance of an object
CameraMovement.Update () (at Assets/Scripts/CameraMovement.cs:17)


I'm not sure what to do to fix this. Any help would be greatly appreciated.
Post edited by gamingislove on
  • You access the target before it is assigned. Also, you're currently changing the position of the target (i.e. the player) instead of the camera.

    ORK Framework comes with a built-in top-down camera that even supports sticking to defined borders around a scene (using box colliders).
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Ah! I'll probably just use the built-in top-down camera then. I'll probably have to figure out how to make my character move more than just left and right, so I'll probably be needing a custom controller script eh?
  • If the built-in controls aren't working for you, you'll need custom controls :)
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Awesome got it working. For anyone interested in additional details: Under Camera Controls I did use the Top Down Border setting and under both the Height and Height Damping settings I put 0. This helped remove any unwanted layer effects from showing up.
Sign In or Register to comment.