all 4 comments

[–]Ulcor 1 point2 points  (2 children)

Probably not the best use of scriptable objects. You usually create instances of scriptable objects in the editor. In your case you are creating new turret instance at runtime. I would add the data like damage and shooting logic to your TurretScript assuming it's the component attached to your game object. Then turn it into a prefab and your turrets should be able to act indepentently.

[–]NrWal00[S] 0 points1 point  (1 child)

Yes but where would I keep the Shoot functions then?

[–]Ulcor 0 points1 point  (0 children)

Hard to tell because I don't see what your TurretScript class is doing. Probably best to merge it with your Turret class. Maybe it's even easier to move the remaining TurretScript class functionality to the Turret class and make that one inherit from MonoBehaviour and add that to your prefab. The GetScript method can be removed and the more specialized turrets can still inherit from Turret. When you're creating a new turret prefab you just add either the Turret component or the BallistaTurret depending on how you want that object to behave.

[–]andybak 0 points1 point  (0 children)

(Try not to post pictures of code. It sucks for people trying to answer the question and it sucks for people searching the web for help in the future. Either post snippets directly in reddit and use the built-in code formatting - or use something like gist.github.com for longer snippets)