'Transform' does not contain a definition for 'positon'

Hello everyone. If this is active the following message appears Assets\Script\Control\AIController.cs(27,39): error CS1061:
What could I have done wrong?

using System.Collections;
using System.Collections.Generic;
using RPG.Combat;
using RPG.Core;
using RPG.Movement;
using UnityEngine;

namespace RPG.Control
{
        public class AIController : MonoBehaviour
    {
        [SerializeField] float chaseDistance = 5f;

        Fighter fighter;
        Health health;
        Mover mover;
        GameObject player;

        Vector3 guardPosition;

        private void Start() {
            fighter = GetComponent<Fighter>();
            health = GetComponent<Health>();
            mover = GetComponent<Mover>();
            player = GameObject.FindWithTag("Player");

            guardPosition = transform.positon;// <---fail
        }

        private void Update()
        {
            if (health.IsDead()) return;

            if (InAttacktRangeOfPlayer() && fighter.CanAttack(player))
            {
                fighter.Attack(player);
            }
            else
            {
                //fighter.Cancel();
                mover.StartMoveAction(guardPosition);
            }
        }

        private bool InAttacktRangeOfPlayer()
        {
            float distanceToPlayer = Vector3.Distance(player.transform.position, transf
            return distanceToPlayer < chaseDistance;
        }

        // called by Unity
        private void OnDrawGizmosSelected() {
            Gizmos.color = Color.red;
            Gizmos.DrawWireSphere(transform.position, chaseDistance);
        }
    }
}

thanks in advance for the help.

you misspelled position as positon where the comment says “fail”.

1 Like

I am blind I thank you!

So am I, but my IDE (I use the non-free Jetbrains Rider, but Visual Studio Code is free) sees for me and puts squiggly lines under misspelled field names, etc. I have been spoiled and can’t code without an IDE anymore (used to use plain old Emacs) but it sure is useful.

1 Like

that sounds very interesting i will download the 30 days free version, do you know if there is an extension ide for visual studio code that would be useful? Thank you for the information seems very helpful to me.

Probably—the initial videos on setting up VS Code would tell you which extensions the teacher uses.

I’m a Rider user too. You should see how much trouble I get into when I type out code on the fly here for students!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms