private void LoadPrefab() { Node prefabNode = Node.CreateChild(); PrefabComponent prefabComponent = prefabNode.CreateComponent <PrefabComponent>(); prefabComponent.SetPrefabGUID(prefabPath); }
/// <summary> /// Constructor /// </summary> /// <param name="moduleName">Name of the module this runtime is assigned to</param> public UIExtenderRuntime(string moduleName) { ModuleName = moduleName; PrefabComponent = new PrefabComponent(moduleName); ViewModelComponent = new ViewModelComponent(moduleName); }
/// <summary> /// Constructor /// </summary> /// <param name="moduleName">Name of the module this runtime is assigned to</param> internal UIExtenderRuntime(string moduleName) { ModuleName = moduleName; PrefabComponent = new PrefabComponent(moduleName); ViewModelComponent = new ViewModelComponent(moduleName); CodePatcher = new CodePatcherComponent(this); }
public void Convert( Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem ) { if (null == this.prefab) { return; } PrefabComponent data = new PrefabComponent( this.type, conversionSystem.GetPrimaryEntity(this.prefab) ); dstManager.AddComponentData(entity, data); }
static private void MakeAtlas() { string spriteDir = Application.dataPath + "/Resources/Prefabs/Sprite"; if (!Directory.Exists(spriteDir)) { Directory.CreateDirectory(spriteDir); } string uiDir = Application.dataPath + "/Art/UI/RawUI"; if (!Directory.Exists(uiDir)) { Directory.CreateDirectory(uiDir);; } DirectoryInfo rootDirInfo = new DirectoryInfo(uiDir); foreach (DirectoryInfo dirInfo in rootDirInfo.GetDirectories()) { GameObject go = new GameObject(dirInfo.Name); PrefabComponent pc = go.AddComponent <PrefabComponent>(); FileInfo[] files = dirInfo.GetFiles("*png", SearchOption.AllDirectories); UIPrefab[] uiPrefab = new UIPrefab[files.Length]; string allPath = ""; int count = 0; foreach (FileInfo pngFile in dirInfo.GetFiles("*.png", SearchOption.AllDirectories)) { UIPrefab uiP = new UIPrefab(); allPath = pngFile.FullName; string assetPath = allPath.Substring(allPath.IndexOf("Assets")); Sprite sprite = AssetDatabase.LoadAssetAtPath <Sprite>(assetPath); uiP.name = sprite.name; uiP.sprite = sprite; uiPrefab[count++] = uiP; } pc.uiPrefab = uiPrefab; allPath = spriteDir + "/" + go.name + ".prefab"; string prefabPath = allPath.Substring(allPath.IndexOf("Assets")); PrefabUtility.CreatePrefab(prefabPath, go); GameObject.DestroyImmediate(go); } AssetDatabase.Refresh(); }
protected override void OnLoad() { numberList = new List <Sprite>(); GameObject spriteNumber = PrefabResManager.Instance.Load(SpritePathDefine.GetPrefabPathByType(EnumSpriteType.SpriteNumber)) as GameObject; PrefabComponent pc = spriteNumber.GetComponent <PrefabComponent>(); pc.Init(); string name = string.Empty; for (int i = 0; i < pc.SpriteDic.Count; i++) { name = "frame_start_coin_number_" + i.ToString(); if (null != pc.SpriteDic && pc.SpriteDic.ContainsKey(name)) { numberList.Add(pc.SpriteDic[name]); } } base.OnLoad(); }
public static List <Action <XmlDocument> > GetMoviePatches(this PrefabComponent instance, string movieName) { return(_lazyGetMoviePatches.Value(instance, movieName)); }