public static GameObject AddAXGameObjectTo(AXParametricObject po, GameObject ngo) { //GameObject obj = new GameObject(prefab.name); //GameObject ngo = GameObject.Instantiate(go); AXGameObject axgo = ngo.AddComponent <AXGameObject>(); axgo.makerPO_GUID = po.Guid; // STATIC FLAGS #if UNITY_EDITOR // *** Could temporarily remove the Lightmap static flag here to allow for Auto... http://forum.unity3d.com/threads/how-to-set-use-staticeditorflags-cant-seem-to-set-them-from-script.137024/ // flags = flags & ~(StaticEditorFlags.LightmapStatic); AXStaticEditorFlags axflags = po.axStaticEditorFlags; if (!po.model.staticFlagsEnabled) { axflags = axflags & ~AXStaticEditorFlags.LightmapStatic; } StaticEditorFlags flags = (StaticEditorFlags)axflags; GameObjectUtility.SetStaticEditorFlags(ngo, flags); #endif if (!string.IsNullOrEmpty(po.tag)) { ngo.tag = po.tag; } ngo.layer = po.layer; po.copyComponentsFromPrototypeToGameObject(ngo); return(ngo); }
public static GameObject createAXGameObject(string name, AXParametricObject po, string subItemAddress = "") { GameObject obj = new GameObject(name); AXGameObject axgo = obj.AddComponent <AXGameObject>(); axgo.makerPO_GUID = po.Guid; // STATIC FLAGS #if UNITY_EDITOR // *** Could temporarily remove the Lightmap static flag here to allow for Auto... http://forum.unity3d.com/threads/how-to-set-use-staticeditorflags-cant-seem-to-set-them-from-script.137024/ // flags = flags & ~(StaticEditorFlags.LightmapStatic); AXStaticEditorFlags axflags = po.axStaticEditorFlags; if (!po.model.staticFlagsEnabled) { //var mask = ~AXStaticEditorFlags.LightmapStatic; //var newValue = originalValue & mask; axflags = axflags & ~AXStaticEditorFlags.LightmapStatic; } StaticEditorFlags flags = (StaticEditorFlags)axflags; GameObjectUtility.SetStaticEditorFlags(obj, flags); #endif if (!string.IsNullOrEmpty(po.tag)) { obj.tag = po.tag; } obj.layer = po.layer; //Debug.Log ("copying protos"); po.copyComponentsFromPrototypeToGameObject(obj); return(obj); }