Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Putting variables under same header as inherited class variables within inspector

Discussion in 'Scripting' started by JamieEdwards, Mar 15, 2023.

  1. JamieEdwards

    JamieEdwards

    Joined:
    Sep 17, 2021
    Posts:
    5
    Hi all,

    I'm trying to utilise inheritance as much as possible. Say I have the following class structure:

    Code (CSharp):
    1. public class Parent
    2. {
    3.     [SerializeField]
    4.     [Header("Finance")]
    5.     private bool isSamePriceThroughoutPark = true;
    6.  
    7.     [SerializeField]
    8.     [Header("General")]
    9.     private ParentStatus status = ParentStatus.Closed;
    10. }
    Now let's say that I want to have my Child class inherit from this Parent class. Is it possible to have additional variables be put under the Finance header within the inspector without making a new Finance header (if this makes sense)?
     
  2. FrankvHoof

    FrankvHoof

    Joined:
    Nov 3, 2014
    Posts:
    258
    In short: Not without making a custom inspector
     
    JohnnyConnor likes this.