Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


operator !=(Object, Object)

Compares if two objects refer to a different object.
Read time 1 minuteLast updated 5 days ago

Definition

  • Type: Operator
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public static bool operator !=(Object x, Object y)

Parameters

The first object to compare.

The object to compare the first object to.

Returns

Type

Description

bool

Examples

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"); } }}