Hello
First time posting so forgive me for any community mistakes.
Below is my script attached to the “Enemy Sprite” GameObject.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyLogic2 : MonoBehaviour
{
public Rigidbody2D enemyRb;
public Transform point0;
public Transform point1;
public Transform point2;
public Transform point3;
public Transform point4;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
private void FixedUpdate()
{
if (transform.position == point0.position)
{
//transform.position = Vector3.MoveTowards(transform.position, point1.position, moveSpeed * Time.deltaTime);
enemyRb.velocity = Vector2.up * 30 * Time.deltaTime;
}
else if (transform.position == point1.position)
{
enemyRb.velocity = Vector2.down * 30 * Time.deltaTime;
Debug.Log("Executed");
}
Debug.Log("Player Position:" + transform.position);
Debug.Log("Point1 Position" + point1.position);
}
}
Below is an image of my game scene, hierarchy and console w/ Debug.

When I run the scene, the first IF statement executes.
However, the second IF statement does not execute. Yet, in the console, you can see that the position of EnemySprite Transform EQUALS the position of POINT1.
(VECTOR3)(-10.56, 8.23, 0,00) == (VECTOR3)(-10.56, 8.23, 0,00)
What could be the reason? Could there be more digits after 8.23XXXX that is not equal to the other vector?
How can I check something like that?
ALSO, when I move the EnemySprite to POINT1 then run the scene, the second IF statement executes but not the first.
Thanks in advance!