forked from Unity-Technologies/UnityCsReference
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTrackedReference.cs
More file actions
46 lines (38 loc) · 1.44 KB
/
Copy pathTrackedReference.cs
File metadata and controls
46 lines (38 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Collections;
using UnityEngineInternal;
using UnityEngine.Bindings;
using UnityEngine.Scripting;
namespace UnityEngine
{
[StructLayout(LayoutKind.Sequential)]
[UsedByNativeCode]
//This class should be internal. Next time we can break backwardscompatibility we should do it.
public class TrackedReference
{
[VisibleToOtherModules("UnityEngine.AnimationModule")]
internal IntPtr m_Ptr;
protected TrackedReference() {}
public static bool operator==(TrackedReference x, TrackedReference y)
{
object xo = x;
object yo = y;
if (yo == null && xo == null) return true;
if (yo == null) return x.m_Ptr == IntPtr.Zero;
if (xo == null) return y.m_Ptr == IntPtr.Zero;
return x.m_Ptr == y.m_Ptr;
}
public static bool operator!=(TrackedReference x, TrackedReference y) { return !(x == y); }
public override bool Equals(object o) { return (o as TrackedReference) == this; }
public override int GetHashCode() { return (int)m_Ptr; }
public static implicit operator bool(TrackedReference exists)
{
return exists != null;
}
}
}