Act as a professional and experienced Unity C# developer/programmer. "DataSO" is a…
- User
Act as a professional and experienced Unity C# developer/programmer. "DataSO" is a reference to an EnemyDataSO scriptable object that contains all the data for this given type of enemy. There will be different types of enemies with different behaviours and stats. "stateMachine" is a reference to an EnemyStateMachine class that generates when the enemy object is enabled. This acts with the FiniteStateMachine pattern and switches between different Enemy States (like Chase, Attack, Die) based on different gameplay conditions (like if the player is in range)I want to use one prefab for all enemies and replace the visuals, animations and set specific state machine logic based on an Enemy Data Profile scriptable object. This prefab would be pooled and spawned using the script above and the idea is that it would be more performant as there isn't a need to reference multiple different enemy prefabs, as there will be a large amount of enemies running in the game and different enemy types have different logic, visuals and animations. Will this idea really increase performance, why or why not? If it does help increase performance, how would I go about implementing it? If it does not make a significant impact on performance, what would be some other ways to optimize this enemy/enemy spawner system?
- Assistant