static string GetScriptString(GPrefabInstance firstTarget) { string script = ""; GFrame frame = firstTarget.GetComponentInParent <GFrame>(); if (frame) { //script += "findPath = \"" + GUtility.GetPath(frame.transform, firstTarget.transform) + "\";\n"; script += "trans = frame.Find(\"" + GUtility.GetPath(frame.transform, firstTarget.transform) + "\");\n"; } GWidget prefab = firstTarget.prefab; for (int i = 0; i < prefab.exportToScriptInfos.Count; i++) { GExportToScriptInfo property = prefab.exportToScriptInfos[i]; string path = GUtility.GetPath(firstTarget.transform, property.target.transform); if (path.StartsWith("/")) { path = path.Substring(1); } script += "trans.Find(\"" + path + "\")."; script += "GetComponent <" + property.type + "> ();"; script += "//" + property.rename + "\n"; } return(script); }
static string GetName(GPrefabInstance loader, GExportToScriptInfo property) { return(GetName(property.type) + "_" + GetName(loader.name)); }