Inspector doesn't show public variables of subclass of a class that inherits from MonoBehavior?

I’m not sure if Unity doesn’t supports this or if I’m doing something wrong.

There is a class that is a MonoBehaviour in an Asset Store asset.
I want to extend it to add functionality, so I did.

However, the inspector doesn’t seem to be showing the public variables I define on the extended class. Is this normal? If so, then how would I make it also show the public variables for editing?

1 Answer

1

Actually, I found the reason. It was because the parent class had a custom editor assigned.

For sight, you can do a second check. You can use the Dot Product to get how close they are to your angle. This link has a simple example. https://docs.unity3d.com/ScriptReference/Vector3.Dot.html The closer to 1 (total range 1 to -1), the closer to the same direction they are. If it's 0, then it's perfectly to the left or right, above or below. If -1, then they are opposite directions. Finally, you can do a RayCast from one object to the other to make sure there are no obstacles preventing them from being seen. https://docs.unity3d.com/ScriptReference/Physics.Raycast.html