-
Notifications
You must be signed in to change notification settings - Fork 3
/
EditorPPtr.cs
41 lines (36 loc) · 998 Bytes
/
EditorPPtr.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PrefabAPI
{
public class EditorPPtr<T> : PPtr<T> where T : EditorObject
{
public EditorPPtr(T obj)
{
this.obj = obj;
}
public void PostProcess(List<EditorObject> overallObjects)
{
if (!overallObjects.Contains(obj))
{
overallObjects.Add(obj);
}
}
public void PostProcess(List<EditorObject> overallObjects, int insertAt)
{
if (!overallObjects.Contains(obj))
{
overallObjects.Insert(insertAt, obj);
}
}
public PPtr<T> ToPPtr(List<EditorObject> overallObjects, int offset = 0)
{
PPtr<T> d = new PPtr<T>();
d.m_FileID = 0;
d.m_PathID = overallObjects.IndexOf(obj) + 2 + offset;
return d;
}
public EditorObject obj;
}
}