public void OnPointerClick(PointerEventData eventData) { if (Input.GetKey(KeyCode.LeftShift)) { ClearPreset(); return; } if (!valid) { return; // allow user to left shift out blueprint so return after that } // TODO: check if adding a part back into your inventory validates the preset if (!blueprint && (builder.reconstructStatus == ShipBuilder.ReconstructButtonStatus.Valid)) { blueprint = ScriptableObject.CreateInstance <EntityBlueprint>(); blueprint.coreShellSpriteID = player.blueprint.coreShellSpriteID; blueprint.coreSpriteID = player.blueprint.coreSpriteID; blueprint.parts = new List <EntityBlueprint.PartInfo>(); foreach (ShipBuilderPart part in cursorScript.parts) { if (!part.isInChain || !part.validPos) { blueprint = null; return; } blueprint.parts.Add(part.info); } if (player.cursave.presetBlueprints == null || (player.cursave.presetBlueprints != null && player.cursave.presetBlueprints.Length < 5)) { player.cursave.presetBlueprints = new string[5]; } player.cursave.presetBlueprints[number - 1] = JsonUtility.ToJson(blueprint); } else if (blueprint) { cursorScript.ClearAllParts(); foreach (EntityBlueprint.PartInfo info in blueprint.parts) { if (!builder.DecrementPartButton(ShipBuilder.CullSpatialValues(info))) { // cursorScript.ClearAllParts(); builder.CloseUI(false); return; } } var x = new EntityBlueprint.PartInfo[blueprint.parts.Count]; blueprint.parts.CopyTo(x); player.blueprint.parts = new List <EntityBlueprint.PartInfo>(x); builder.CloseUI(true); OnPointerExit(null); player.Rebuild(); } }