Создал скрипт в юнити, вписал код:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
{
public Transform SelfTransform;
void Update()
{
SelfTransform.Translate(0.1f, 0, 0);
}
}
присойденил к персонажу и вылазит эта ошибка:
UnassignedReferenceException: The variable SelfTransform of NewBehaviourScript has not been assigned.
You probably need to assign the SelfTransform variable of the NewBehaviourScript script in the inspector.
UnityEngine.Transform.get_position () <0x38fe2290 + 0x0006a> in <6a3f68e4ae18416e9941eafa34caba8a>:0
UnityEngine.Transform.Translate (UnityEngine.Vector3 translation, UnityEngine.Space relativeTo) (at C:/buildslave/unity/build/Runtime/Transform/ScriptBindings/Transform.bindings.cs:118)
UnityEngine.Transform.Translate (System.Single x, System.Single y, System.Single z) (at C:/buildslave/unity/build/Runtime/Transform/ScriptBindings/Transform.bindings.cs:134)
NewBehaviourScript.Update () (at Assets/NewBehaviourScript.cs:10)
Что сделать чтобы работало?
The variable SelfTransform of NewBehaviourScript has not been assigned.
You probably need to assign the SelfTransform variable of the NewBehaviourScript script in the inspector