LogFAQs > #979346004

LurkerFAQs, Active Database ( 12.01.2023-present ), DB1, DB2, DB3, DB4, DB5, DB6, DB7, DB8, DB9, DB10, DB11, DB12, Clear
Topic List
Page List: 1
TopicI've been working on a 3d platformer game (in unity)
TheGoldenEel
03/13/24 12:15:54 PM
#106:


divot1338 posted...
Did you make a typo somewhere in one of the Collectable objects and its different from the orhers?
No, that wasn't it

After I typed that out I had somewhat of a eureka/d'oh moment. I was setting the objects as inactive when they were collected, and FindObjectsWithTag() only finds active objects. So I have to keep the parent object active and deactivate the child which contains the trigger and mesh. Also, it wasn't even necessary to do a FindObects where I was doing it, because all I have to do to save is save an array of booleans, where the index of the boolean corresponds to the ID of the given collectable.

So, on loading the game, FindObjectsWithTag, set each collectable status to active/inactive based on the boolean value of the saved array, and then I just update that array in-game as the collectables are picked up.

After a bunch of fiddling and testing, I got it working:

https://youtu.be/YgHe_ewUtdc

next: i think i'm going to continue with the enemy AI training I had started a few weeks ago, coupled with implementing an attack button

---
BLACK LIVES MATTER
Games: http://backloggery.com/wrldindstries302 \\ Music: http://www.last.fm/user/DrMorberg/
... Copied to Clipboard!
Topic List
Page List: 1