tomhoq
tomhoq

Reputation: 57

Public variables not showing on inspector?

I have this script that i have inserted into an object that is a card with no more scripts on it. In the inspector though I cannot change the values of these public variables help? All the scripts are saved and have been compiled

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class CardDisplay : MonoBehaviour
{
    public Card card;

    public Text nameText;
    public Text descpritionText;

    public Image artworkImage;

    public Text levelText;
    public Test costText;
}

enter image description here

Upvotes: 0

Views: 7035

Answers (1)

Hassan Saeed
Hassan Saeed

Reputation: 7080

There is 3 way which can help you

  1. Ensure that you don't have any compile error in c# scripts

  2. Use [System.Serializable] before your class name like

    [System.Serializable] public class...{ }

  3. remove regions code before public variables like

    //#if UNITY_ANDROID public String androidAdmobAppId;

and if still not working then use your all public variables on top of your class(and private variables on bottom )like

public class BillingManager : MonoBehaviour
{
    //#if UNITY_ANDROID
    public String androidAdmobAppId;
    public String androidInterstitalAdUnitId;
    public String androidBannerAdUnitId;
    //#endif
    //#if UNITY_IPHONE
    public String iosAdmobAppId;
    public String iosInterstitalAdUnitId;
    public String iosBannerAdUnitId;
    //#endif
    private BannerView bannerView;
    private InterstitialAd interstitial;
}

Upvotes: 1

Related Questions