Object.operator !=

Unity · Версия 2020.3 LTS · Scripting · Object

Object.operator !=

public static bool operator !=(Object x, Object y);

Описание

Сравнивает, ссылаются ли два объекта на другой объект.

using UnityEngine;

public class Example : MonoBehaviour
{
    Transform target;
    void Update()
    {
        // the target object does not refer to the same object as our transform
        if (target != transform)
        {
            print("Another object");
        }
    }
}

Обновлено 17 ноября 2026 г.