Quantcast
Channel: Questions in topic: "class instance"
Viewing all articles
Browse latest Browse all 131

Noob question about class inheritance

$
0
0
I'm kinda new to scripting and I've got a basic question about class inheritance in Unity. Let's say I want to make a base class named Enemy, which will contain the basic features shared by all enemies, and a derived class for every enemy type, for example, Orc and Goblin. So I've got three different scripts: Enemy (the parent class), Orc and Goblin. And the question is: to which gameObjects should I attach them? I can only imagine the Orc and Goblin scripts must be attached to the Orc and Goblin prefabs, but where do I put the Enemy class? Thanks in advance!

Viewing all articles
Browse latest Browse all 131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>