Author: Brandon Vargas
Date Posted: 10/2/2023
This week my problem was more within a moments time and wasn’t anything truly trivial. The lead of the group asked that I create a “special” pickup/collectable where it has multiple parts. To further explain it’s five pickups technically speaking but they all go toward one goal. The five pickups are letters that spell “SPEED” and the player is picking up each letter to complete that objective(to spell SPEED). Hopefully that makes proper sense. With this concept in mind I needed to create a way to manage and keep track of each letter in one instance, or at least that’s what I wanted. At first what I tried was making a blueprint that had 5 meshes and box colliders for each mesh. This seemed fine at first but became a problem when I wanted them to act/function separately which I will elaborate on shortly. Something I wanted to add in as a personal touch was that each letter would spin in place. I was expecting to have to slightly rotate each object in tick or some method that worked per frame, I ended up just adding a rotating movement component. With that the only way to have had each letter rotate at different speeds or different directions I would have to also make five rotating movement components. Basically I would have to do everything five times for every bit of functionality which I found messy. I then decided to make one separate blueprint for the letters and have them within another to treat the second as a manager. I ended up doing the same things just once in one blueprint and using that blueprint in the manager five times. The problem then became that because I was using the same blueprint five times I couldn’t figure out a way to change the meshes so I had one parent letter and made 5 letter children since their meshes won’t be changing in game anyways. The true problem that stumped me for a bit was using the letter blueprint inside of another blueprint meant they were all child actor components and I couldn’t access their values such as any variables they had in them. If I couldn’t figure out this problem I had to undo most of what I already did.
To solve this issue I tried multiple things before I found my solution. First I tried going through the letter or child actor component’s child actor object reference but that didn’t do anything. I then tried using the component or the child actor reference to access a function that would change the values in the letters’ blueprints but that didn’t work. I then made actor object reference variables that did indeed find the variables I was looking for and the function I had made. Although I had access to what I was looking for, the references still referred to nothing and did not make changes to the letters. At this point I ran out of ideas and started looking up different things for how to use a blueprint in another blueprint. I don’t remember which way I had worded the search where I found a page that explained using the child actor of the component was a key to the process. I used that to cast the actor object reference variables I made to the corresponding letter and got their references correctly. So far I have gotten the letters to rotate separate from each other, be collected separately, and function separately. I now just need to finish creating a way to keep track of them as far as which ones have been collected, if all of them have been collected, etc.
Did you like this post? Tell us
Leave a comment
Log in with your itch.io account to leave a comment.