parent variable nulling out in child...

I’ve searched through all the reference and forums but nothing seems to be working. I have a parent script “EventManager” with variables that the child script “proxObj” is trying to call. The variables are coming up in the code hinting so it’s seeing them but for some reason they are null in the child script. I even have a log in the parent to make sure the variable is set which it is at runtime. Below is my code for the two with comments on the various versions i’ve tried. Tried protected and public for the variables with the same result.

Even tried to create a return method (function) to see if that would work but has the same result. Doesn’t the child inherit all public and protected items from the parent by default?

using UnityEngine;
using System.Collections;

public class EventManager : MonoBehaviour {
	protected GameObject m2;
	protected Vector3 m2Pos;
	void Start() {
		m2 = GameObject.Find("m2");

	void Update () {
		m2Pos = m2.transform.position;
		Debug.Log ("parent " + + " position ~ " + m2Pos);
		// log above shows m2Pos is being updated but NULL (0, 0, 0) in child
		// both public and protected have same result

	public Vector3 getM2Pos(){
		return m2Pos;

using UnityEngine;
using System.Collections;

public class proxObj : EventManager {
	private float delta;
	private Vector3 thisPos;
	private Vector3 test;

	void Start () {
		thisPos = this.transform.position;
	// Update is called once per frame
	void Update () {
		//test = getM2Pos ();
		//test = this.transform.parent.GetComponent<m2>();
		//test = this.transform.FindChild("m2Pos").GetComponent<EventManager>();
		//test = this.transform.parent.GetComponent<EventManager>().m2Pos;
		//test = transform.parent.GetComponent (EventManager).getM2Pos();

		//EventManager myParent = transform.parent.GetComponent<EventManager>();
		//test = myParent.m2Pos;
		test = m2Pos;

		Debug.Log ("Test --- " + test);

		// if statement to do check only if object is visible in camera
		delta = Vector3.Distance (m2Pos, thisPos);
		// long hand version of Distance above
		//delta = Mathf.Sqrt ((thisPos.x - refPos.x)*(thisPos.x - refPos.x) + (thisPos.y - refPos.y)*(thisPos.y - refPos.y) + (thisPos.z - refPos.z)*(thisPos.z - refPos.z));

		// why are parent variables NULL in child?
		// both variables m2 and m2Pos are coming up in the code hint

		Debug.Log ("m2Pos ~ " + m2Pos);
		Debug.Log ( + " position ~ " + thisPos);
		Debug.Log (delta);
		Debug.Log ("----------");


Probably because your extending class hides the Start and Update methods so the ones in the base class never get called.

You should define the base class methods “virtual”, the child class functions as “override” and then call base.Update(); and base.Start() in the respective child methods