Class in Inspector

Updated on March 24, 2018 in [A] GUI
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
3 on March 24, 2018

Hey guys I have a problem with me inspector.

The situation, I have a base class attack and the derived classes melee-attack, ranged-attack etc. . If i make a public var attack on a Unit script is there a way so i can assign them in the inspector or must I hard code all the attacks, and work with switch case or something?

  • Liked by
Reply
1 on March 24, 2018

type [system.serializable] above your base class.

on March 24, 2018

It helps, I guess?

https://imgur.com/wZSra6W

 

In the Base class I added the [Serializable] 

 

And in the Unit_Script I only wrote:

public AttackBaseClass[] attacks;

Show more replies
  • Liked by
Reply
Cancel
0 on March 24, 2018

I found a solution a propertyDrawer do the Trick.

  • Liked by
Reply
Cancel