Sep 18, 2024

Unity - Code runs in editor but not in build

 Just had this really stupid issue happening where my code was working in the editor but when building the game and running the build executable, the code wasn't running at all.

Tried debugging the executable and couldn't put breakpoints on the specific class related to the issue... I turned to chatgtp and he suggested using [Preserve]

So, today I learned Unity strips away unreferenced code to save up on build size.

The problem with my class was that it wasn't used by any other classes. The public methods were meant to be called in the editor, by way of Unity Events... so my class was working fine in the editor... but it didn't exist in the executable build :')

The trick is to put a [Preserve] before the class, to prevent it from being ignored during build run. More info here: https://docs.unity3d.com/ScriptReference/Scripting.PreserveAttribute.html

And here's the class:


using System;
using UnityEngine;
using UnityEngine.Scripting;

namespace AF.Tutorial
{
    [Preserve]
    public class TutorialManager : MonoBehaviour
    {
        [SerializeField] private TutorialSection[] tutorialSections;
        [SerializeField] private TutorialSection startingTutorial;

        private TutorialSection activeTutorialSection;

        void Start()
        {
            InitializeTutorials();
        }

        private void InitializeTutorials()
        {
            DisableAllTutorials();

            if (startingTutorial != null)
            {
                activeTutorialSection = startingTutorial;
            }
            else if (tutorialSections.Length > 0)
            {
                activeTutorialSection = tutorialSections[0];
            }

            if (activeTutorialSection != null)
            {
                activeTutorialSection.gameObject.SetActive(true);
                activeTutorialSection.Activate();
            }
        }

        private void DisableAllTutorials()
        {
            foreach (var tutorial in tutorialSections)
            {
                if (tutorial != null)
                {
                    tutorial.gameObject.SetActive(false);
                }
            }
        }

        public void Advance()
        {
            ChangeTutorialSection(1);
        }

        public void Return()
        {
            ChangeTutorialSection(-1);
        }

        private void ChangeTutorialSection(int direction)
        {
            int currentIndex = Array.IndexOf(tutorialSections, activeTutorialSection);

            if (currentIndex >= 0)
            {
                int newIndex = currentIndex + direction;

                if (newIndex >= 0 && newIndex < tutorialSections.Length)
                {
                    activeTutorialSection.gameObject.SetActive(false);
                    activeTutorialSection = tutorialSections[newIndex];
                    activeTutorialSection.gameObject.SetActive(true);
                    activeTutorialSection.Activate();
                }
            }
        }
    }
}

Jul 3, 2024

Cacildes Adventure - Preview of Sewers in Cecily Town

 Working on new content for Cacildes Adventure!

I'm doing some improvements on AI and combat so that it will be more dynamic with enemies cutting distance to attack you!





The way the cutting distance works is we have two functions, MoveTowardsTarget and StopMoveTowardsTarget, where we define in the animation clip where we want the enemy to start moving towards us, and then we stop on a keyframe later. This allows for the animation to decide if the enemy should move closer.

This is all just a flag in code, that allows special behaviour to occur in the OnAnimatorMove() function of our AI character:


So if we are cutting distance, let's use the navmesh to do it. Otherwise, just sync the agent and character controller to the root motion of the animation playing (which is the default behaviour).


That's a nice way to handle this, and it makes combat a lot more fun!

Anwyay, expect more news soon :-) Stay tuned!

Jun 9, 2024

Polygon City - Negroni Vacance (EP)

Jun 5, 2024

Cacildes Adventure: New work begins with a character creator

 As I begin plans for another expansion for Cacildes Adventure, first thing I'm working on is a character customization tool to customize Cacildes!




The way it works (or I thought about it) was creating body parts container game objects to store all the available customization pieces:

This works great with my existing equipment logic for armors, because if a helmet requires us to hide the hair of the character, for example, we just need to hide the parent container "HairContainer", and voilà, it is agnostic to whatever hair is selected because that's a child of the HairContainer.


You'll be able to edit many details of the model and also the name of the character.

I'm also adding localization! More on that later.

Stay tuned for more :-)


Jun 4, 2024

Foodtrip to "Casa Chef Victor Felisberto" (Abrantes)

We decided to travel to Abrantes to try out a restaurant that had been on my radar for some time. The choice was between revisiting "A Velha" for the 5th or 6th time, one of my favorite restaurants, or risking a change and going to try something new. So, we decided to go to Casa do Chef Victor Felisberto.

Beforehand, we spent the afternoon strolling around Agrual, a welcoming place for those seeking some refreshment in the afternoon in the makeshift pool with spring water. We felt a bit underdressed afterwords to go dine somewhere fancy, but our hunger spoke louder!


When we arrived, the staff was immediately very friendly, with many helpful and cheerful collaborators. There were already people dining, and we realized that the restaurant would quickly fill up.

We started with a classic bread, olives, and truffle butter couvert, along with fabulous creamy cheese. My hands smelled like goat until the next day.

To accompany our meal, we decided to try the Quinta d'Atela sparkling wine. It had been a choice for New Year's Eve in 2023, and I remember liking the acidic but somewhat complex profile of this wine.

For the starter, we ordered the fish soup. It was broth-like, with a noticeable hint of tomato and fish, seasoned with the essential and plenty of parsley - the result was complex and harmonious, without excessive salt. Perhaps some might prefer the typical spiciness of fish soups, but it was not mandatory.

For the main course, we ordered a dish to share of carp with crayfish. A dish, in fact, is a large portion in this restaurant. The ladies said it was a very well-served portion for one person, which actually serves two, and they were not mistaken. On the other side, we overheard someone asking if the seafood rice would be enough for a group of four. If it came as generously as our carp, it would easily serve six people, although perhaps we should remember that we were all Portuguese there.

The carp was perfectly cooked and covered with a layer of mayonnaise. The lady warned us that it came like this, and yet we dared, but I must say that the mayonnaise, despite having the welcome acidity to complement the dish, became quite heavy halfway through the meal. Perhaps the quantity was the problem. I imagined that the carp and crayfish alone had enough to shine because they were really very good. But both with their typical muddy flavor may need some extra help. Anyway, it was a megalomaniac dish in terms of portions, and we couldn't finish it, perhaps because of the said mayonnaise.

To finish the meal, my girlfriend ordered something that intrigued her, a petit gateau with pumpkin jam filling. It didn't disappoint. Nor did I. A beautiful choice, judging by the bite I had. But I decided on the rice pudding because I wanted to try the chef's variation, as it is one of the desserts that I like most from my mother. Again, I was pleasantly surprised, with a very creamy rice (somewhat al dente, but personally, it's to my liking), accompanied by a tartlet with lemon cream (?) - a nice twist on the lemon zest that we put in the rice milk, resulting in a very harmonious ending. I paired it with a Madeira Verdelho wine, semi-dry - the menu suggested a Port wine, I think it wasn't far off, but I confess I don't understand much about pairing.

(The Pumpkin Petit Gateau)


(The Rice Pudding)

Our bill came to about 90 euros, which is to be expected in a restaurant where main courses start at almost 20 euros per person. We were curious about the rest of the menu, which is quite extensive, especially in the variety of meats it offers. We will certainly have the opportunity to explore it on a future visit!

A note for the elegantly decorated space with interesting details - the lamps are covered with recycled shredded cardboard. Oh, and there is also private parking!

In summary, it's definitely worth a visit. Another beautiful place to eat in Abrantes.


~~~

Decidimos viajar até Abrantes para experimentar um restaurante que já estava na minha mira há algum tempo. A escolha era entre revisitar "A Velha" pela 5ª ou 6ª vez, um dos meus restaurantes favoritos, ou arriscar mudar o hábito e ir conhecer algo novo. Então decidimos ir à Casa do Chef Victor Felisberto.

Antes ainda fizemos uma tarde de passeio pelo Agrual, um lugar convidativo a todos os que querem algum refresco durante a tarde na piscina improvisada com água da nascente. Sentimo-nos um pouco mal vestidos para ir a qualquer lado, mas fomos mesmo assim, pois a fome falou mais alto!

Quando chegámos, a staff foi imediatamente muito simpática, com imensas colaboradoras prestáveis e bem dispostas. Já havia pessoas a jantar, e percebemos que o restaurante rapidamente iria encher.

Começámos por um couvert clássico de pão, azeitonas e manteiga trufada e com azeitonas, e um queijo amanteigado fabuloso. As minhas mãos ficaram a cheirar a cabra até no dia seguinte.

Para acompanhar a refeição, decidimos provar o Quinta d'Atela frisante. Já havia sido uma escolha no passado ano novo de 2023, e lembro-me de gostar bastante do perfil ácido mas algo complexo deste vinho.

Para entrada, pedimos a sopa de peixe. Estava caldosa, com um travo notório a tomate e a peixe, temperada com o essencial e bastante salsa - o resultado é complexo e harmonioso, sem sal excessivo. Talvez aqui alguns preferissem o picante típico das sopas de peixe, mas não era obrigatório.

Para prato principal, pedimos um prato para dividir de carpa com lagostins. Um prato, na verdade, é uma dose grande neste restaurante. As senhoras disseram que era uma dose bastante bem servida para uma pessoa que na verdade serve duas, e não estavam enganadas. Do outro lado ouvíamos alguém a perguntar se o arroz de marisco chegava bem para um grupo de quatro. Se veio tão bem servido como a nossa carpa, serviria facilmente para 6 pessoas, embora talvez tenhamos de nos lembrar que somos todos portugueses ali.

A carpa estava perfeitamente cozinhada e coberta por uma camada de maionese. A senhora avisou-nos que vinha assim, e mesmo assim arriscámos, mas devo dizer que a maionese, apesar de ter o ácido bem-vindo para complementar o prato, torna-se bastante pesada a meio da refeição. Talvez a quantidade seja o problema. Fiquei a imaginar que a carpa e os lagostins sozinhos tinham o suficiente para brilhar, pois estavam mesmo muito bons. Mas ambos com o seu sabor típico a lodo talvez precisem de alguma ajuda extra. Seja como for, era um prato megalómano em termos de doses, e não conseguimos terminar, talvez por culpa da dita maionese.

Para finalizar a refeição, a minha namorada pediu algo que a intrigou, um petit gateau com recheio de doce de abóbora. Não a desiludiu. Nem a mim. Uma bela escolha, pela garfada que comi. Mas decidi-me pelo arroz doce, pois quis conhecer a variante dos chefs, visto que é uma das sobremesas que mais gosto da minha mãe. Novamente, fiquei surpreendido pela positiva, com um arroz bastante cremoso (algo al dente, mas pessoalmente é do meu agrado), acompanhado de uma tartelete com creme de limão (?) - um belo twist à casca de limão que colocamos no leite do arroz doce, resultando num final bastante harmonioso. Acompanhei com um vinho da Madeira Verdelho, meio-seco - a carta sugeria um vinho do Porto, penso que não ficou longe, mas confesso que não percebo muito de harmonização.

A nossa conta ficou em cerca de 90 euros, o que é de esperar num restaurante cujos pratos principais começam quase todos nos 20 euros por pessoa. Ficámos curiosos com o resto da carta, que é bastante longa, principalmente na variedade de carnes que oferece. Certamente teremos a oportunidade de conhecer numa próxima visita!

Fica ainda uma nota para o espaço bastante elegante e com detalhes interessantes de decoração - os candeeiros estão cobertos com cartão reciclado rasurado. Há ainda estacionamento privado!

Fica a recomendação. Mais um belo lugar para se comer em Abrantes.

May 29, 2024

Cacildes Adventure: Expanding the combat and the Mimic Chest

Couple of new additions to the next update of the game!

Enemies can now follow-up attacks with more combos. Before, they could follow-up any attack with an additional combo, but now it's 3 or even 4 attacks in a row!


Also working on some new enemies for the Sunkenland expansion (coming this summer). Take a look at the mimic chest!



 

May 27, 2024

Cacildes Adventure - 20% off on Steam this week!

20% off on Steam this week! Check it out :-D

Man, it's been a while! My game has been released to Steam this April and I didn't even post about it here on the blog, so I'm doing it now.


It's currently 20% off on steam, and it's been getting better with each weekly update. For every bug I fix, I try to add some new weapon or spell or something new to the game. I think it's going to be like that for a while, but I have plans for a small expansion this summer. Anyway, do check it out! It plays great on the steam deck as well. ;)