I came across a dilema that I judge to be very simple, but I can’t figure it out, so let’s say we have this:
//Gun.cs
using UnityEngine;
class Gun : MonoBehaviour
{
void Start()
{
print("Print Gun");
}
}
//Rifle.cs
using UnityEngine;
class Rifle : Gun
{
void Start()
{
print("Print Rifle");
}
}
I would like to drag the Rifle.cs script into a game object, press run, and have both prints appear on my console.
Is there any way to achieve that? without having to write some code in all my classes that derive from Gun?