After finding this useful tool I want to use to organize my scripts. However, when I add the third "category", it gives me the following error:
attribute 'Header' is not valid on this decleration type. It is only valid on 'field' declerations.
I have tried to use the "order = x" argument, but without succes. Any idea what's going on? I cant seem to find anything about it in the Unity docs.
[Header("Feedback settings")]
public string gameName = "";
public string sendToEmail = "";
[Space(5)]
[Header("Canvas settings")]
public Sprite emptyStar, fullStar, button;
[Range(20, 100)]
public float canvasSize;
[Range(-1, 1)]
public float canvasXPosition, canvasYPosition;
public float spritePadding, buttonYOffset;
[Header("Rate settings")] //<-- this one is marked with the above error
public enum MarketPlaces {PC, mobileTablet};
public MarketPlaces compileFor = MarketPlaces.PC;
public string rateLink;
Additional code for Joe Blow
[Header("Canvas settings")]
public Sprite emptyStar, fullStar, button;
[Range(20, 100)]
public float canvasSize;
[Range(-1, 1)]
public float canvasXPosition, canvasYPosition;
public float spritePadding, buttonYOffset;
public enum MarketPlaces { PC, mobileTablet };
[Header("Feedback settings")]
public string gameName = "";
public string sendToEmail = "";
[Header("Rate settings")]
public MarketPlaces compileFor = MarketPlaces.PC;
public string rateLink;
[HideInInspector]
public GameObject currentCanvas, tempButton, subCanvas;
private Button[] starButtons;
private Vector2 canvasPosition;
private GameObject rateMeCanvas, rateButton, contactField, openClient;
The way Unity have done it, you can't follow it with an enum.
Fortunately, the solution is simple - just move the enum behind it!
[Header("Feedback settings")]
public string gameName = "";
public string sendToEmail = "";
[Space(5)]
[Header("Canvas settings")]
// not possible...
// public Sprite emptyStar, fullStar, button;
// you must do this...
public Sprite emptyStar;
public Sprite fullStar;
public Sprite button;
[Range(20, 100)]
public float canvasSize;
[Range(-1, 1)]
public float canvasXPosition, canvasYPosition;
public float spritePadding, buttonYOffset;
public enum MarketPlaces {PC, mobileTablet};
[Header("Rate settings")] // just move to here!
public MarketPlaces compileFor = MarketPlaces.PC;
public string rateLink;