Jump to content

Fields of abstract parent class does not shown in editor


photo

Recommended Posts

Posted (edited)

I have an abstract class AbstractEngine and a class Engine that inherits from it. (class does not inherit from Component, but the Engine class is included in the component). How can I display public fields of AbstractEngine  parent class in the editor? public fields of the Engine are displayed, but public fields of the parent class are not.

[showInEditor] [ParameterProperty] also does not give any result

Edited by nexys.stormcloud
Posted
1 hour ago, silent said:

nexys.stormcloud

Can you show us example .cs component?

Thanks!

Hi, thanks for quick reply!

//parent class
Public abstract class AbsEngine
{
  public float power;
}

//child class
Public class FuelEngine:AbsEngine{
 	public float fuel; 
}

//component that includes child class
[Component(PropertyGuid="...")]
public class FlyerChassy:Component
{
  //-----//
  [ShowInEditor]
  FuelEngine[] engines;
  
  //-----//
}

result in editor:

image.png.7708c08d7dcb08c40e086e968b08acb9.png

child field 'fuel' is displayed,

but inherited parent field 'power' is not.

 

thanks.

  • Like 1
Posted

Thanks for the example, it's very helpful!

Looks like there is a bug in C# Property generator that can't handle such syntax. We plan to fix this issue in the upcoming update (2.20) later this spring.

  • Like 2

How to submit a good bug report
---
FTP server for test scenes and user uploads:

×
×
  • Create New...