Tuning/Reuseability Question

I’m wondering if there’s a method to centralize tuning for a game while still keeping the code reusable. What I would like to do is have the standard serialized fields for tuning on game objects, but have some optional way to query for a value that’s set in a central place.

So for example, I have an enemy and I want to change his movement speed. There’s a movementSpeed set on the enemy. I want to be able to add a method that tests if say, a Tuning class exists in the project, or something similar to this. I think trying to test for a class that doesn’t exist will cause an error, so would it be okay to do this in a try/catch block? Or is there a more clever way to do this using the event system somehow?

Hi Zafaron,

That sounds indeed like a job for an event system. You have to look for the/a Tuning instance in the enemy script. If there is one, subscribe to the event in the Tuning instance.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms