Hi,
I am currently working on a little terrain tool and got stuck with a problem I can t solve.
Neither the Awake, Start or Update methods of the RFTerrainRoad script are called. The GameObject is created at the MenuAddRoad function.
Can someone give me a hint on how to fix this?
Greetings Eduard
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class RFTerrainPath : MonoBehaviour
{
private List<RFTerrainPathControlPoint> controlPoints;
public List<RFTerrainPathControlPoint> getControlPoints()
{
return controlPoints;
}
/*
// Use this for initialization
public virtual void Awake ()
{
Debug.Log ("awake RFTerrainPath");
controlPoints = new List<RFTerrainPathControlPoint> ();
controlPoints.Add ( new RFTerrainPathControlPoint(new Vector3 (60, 1, 11),Quaternion.identity,Vector3.one));
controlPoints.Add ( new RFTerrainPathControlPoint(new Vector3 (65, 1, 11),Quaternion.identity,Vector3.one));
}
*/
/*
public void Awake()
{
Debug.Log ("awake RFTerrainPath");
}
public void Start()
{
Debug.Log ("start RFTerrainPath");
}
public void Update()
{
Debug.Log ("update path");
}*/
}
using UnityEngine;
using UnityEditor;
using System.Collections;
public class RFTerrainRoad : RFTerrainPath
{
[MenuItem("Terrain/RFTerrain/Add RFTerrainRoad")]
static void MenuAddRoad()
{
GameObject newRoad = new GameObject ("RFTerrainRoad");
newRoad.AddComponent<RFTerrainRoad>();
Debug.Log ("add road");
}
void Awake()
{
Debug.Log ("awake road");
}
void Start()
{
Debug.Log ("start road");
}
// Update is called once per frame
void Update () {
Debug.Log ("update road");
}
}