5
|
1 using UnityEngine;
|
|
2 using System.Collections;
|
|
3 using System.Collections.Generic;
|
|
4 public class ParentObject : MonoBehaviour {
|
|
5
|
|
6 public GameObject Value;
|
|
7 public NodePath Path;
|
|
8 public Dictionary<string, Component> dic = new Dictionary<string, Component>();
|
|
9
|
|
10 public ParentObject (GameObject value, NodePath path) {
|
|
11 this.Value = value;
|
|
12 this.Path = path;
|
|
13 GetComponent ();
|
|
14 Logs ();
|
|
15 }
|
|
16
|
|
17 public void GetComponent () {
|
|
18 Component[] comps = this.Value.GetComponents<Component>();
|
|
19 foreach (Component component in comps) {
|
|
20 if (component.GetType ().ToString () != "UnityEngine.Transform") {
|
|
21 Debug.Log (component.GetType ().ToString ());
|
|
22 dic.Add (component.GetType ().ToString (), component);
|
|
23 }
|
|
24 }
|
|
25 }
|
|
26
|
|
27 public void Logs () {
|
|
28 string s = "<";
|
|
29 foreach (int num in Path) {
|
|
30 s += num + ",";
|
|
31 }
|
|
32 s += ">";
|
|
33 print (s);
|
|
34 }
|
|
35 }
|