NullReferenceException error help me

Error:
NullReferenceException
UnityEngine.Transform.get_rotation () (at C:/BuildAgent/work/842f9557127e852/Runtime/ExportGenerated/Editor/UnityEngineTransform.cs:56)
movetarget1.Update () (at Assets/panscript/movetarget1.cs:31)

mycode is :
using UnityEngine;
using System.Collections;

public class movetarget1 : MonoBehaviour {
public Transform curt1;
public int speed1;
public int rspeed1;
string tagname1 = “b0”;
int b =1;
public int inc1 = 0;
bool r1 = true;
private Transform myTransform1;
// Use this for initialization
void Avake()
{
myTransform1 = transform;
}
void Start ()
{

}

// Update is called once per frame
void Update ()
{
GameObject go = GameObject.FindGameObjectWithTag(tagname1);
curt1 = go.transform;
if (r1)
{

myTransform1.rotation = Quaternion.Slerp(myTransform1.rotation, Quaternion.LookRotation(curt1.position - myTransform1.position), rspeed1 * Time.deltaTime);
//move to target
myTransform1.position += myTransform1.forward * speed1 * Time.deltaTime;
}

}
void OnTriggerEnter(Collider other)
{

switch (b)
{
case 1:
{

if (other.gameObject.tag == “b0” inc1 == 0)
{
tagname1 = “b1”;
//inc++;
}
if (other.gameObject.tag == “b1”)
{
tagname1 = “b2”;
}
if (other.gameObject.tag == “b2”)
{
tagname1 = “b3”;
}
if (other.gameObject.tag == “b3”)
{
tagname1 = “b4”;
}

if (other.gameObject.tag == “a4”)
{
tagname1 = “b5”;
}
if (other.gameObject.tag == “b5”)
{
tagname1 = “b6”;
}
if (other.gameObject.tag == “b6”)
{
tagname1 = “b7”;
}
if (other.gameObject.tag == “b7”)
{
tagname1 = “b8”;
}
if (other.gameObject.tag == “b8”)
{
tagname1 = “b9”;
}
if (other.gameObject.tag == “b9”)
{
tagname1 = “b1”;
//a = Random.RandomRange(1, 4);
//inc–;

}

break;
}
}
}
}

U wrote the wrong spelling of Awake. Correct it with void Awake

Null reference exceptions happen when the variable you are trying to access is null. In this case, the Awake function was spelt wrong (Avake) so the myTransform1 object never gets set to the transform resulting in … null ref :slight_smile: