-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNestedPrefabData.cs
More file actions
62 lines (42 loc) · 1.61 KB
/
Copy pathNestedPrefabData.cs
File metadata and controls
62 lines (42 loc) · 1.61 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using UnityEngine;
using System;
[Serializable]
public class GameObjectData {
public int id;
public string name;
/// <summary> Relative path on Hierarchy </summary>
public string hierarchyPath;
public int hierarchyPathId;
public float positionX, positionY, positionZ;
public float rotationX, rotationY, rotationZ;
public float scaleX, scaleY, scaleZ;
public bool active;
public void CopyDataTo(Transform transformObject)
{
transformObject.name = name;
transformObject.localPosition = new Vector3(positionX, positionY, positionZ);
transformObject.localEulerAngles = new Vector3(rotationX, rotationY, rotationZ);
transformObject.localScale = new Vector3(scaleX, scaleY, scaleZ);
transformObject.gameObject.SetActive(active);
}
public void CopyFrom(Transform transformObject)
{
name = transformObject.name;
positionX = transformObject.localPosition.x;
positionY = transformObject.localPosition.y;
positionZ = transformObject.localPosition.z;
rotationX = transformObject.localEulerAngles.x;
rotationY = transformObject.localEulerAngles.y;
rotationZ = transformObject.localEulerAngles.z;
scaleX = transformObject.localScale.x;
scaleY = transformObject.localScale.y;
scaleZ = transformObject.localScale.z;
active = transformObject.gameObject.activeSelf;
}
}
[Serializable]
public class NestedPrefabData : GameObjectData {
/// <summary> Path on assets folder </summary>
public string prefabPath;
public GameObject prefabObject;
}