Basic type properties not appearing in inspector

Hi

New to unity, and this should be simple problem. Want edit the initial value of a property in a script, but can’t see them in inspector.

Its an existing code base I have updated from old unity from few years ago, entire project builds and runs so no script errors.

Some scripts have public basic type properties (int, strings etc) but none of them are appearing in inspector however game objects appear ok, my understanding is all properties should appear ?

This script screen shot attached is quite complicated but same happens on simple ones, game objects appear but not basic types. Am I missing something fundamental ?

Here is a simpler script from app, image GameObject appears in inspector but not videoFile or imageDuration

using UnityEngine;
using System.Collections;

public class Splash : MonoBehaviour {
    public string videoFile;
    public GameObject image;   
    public float imageDuration = 3;

    public bool complete {
        get { return (_imageTimer >= imageDuration); }
    }

    private int _state = 0;
    private float _imageTimer = 0;


    protected void Start() {
        if (image != null) { image.SetActive(false); }
    }

The Inspector screen shot above suggests you’re inspecting the script itself, in the Project tab, not some object using it in the Hierarchy tab.

The script defines properties, but these properties get values when the script is actually used on some GameObject. This would be either an object in the Hierarchy, or a prefab in the Project (but even that is created by first assembling an object in the Hierarchy).

Ah ok Thanks. Slowly wrapping my head around this Unity malarky.

1 Like

Don’t neglect the tutorials you’ll find under the Learn link at the top of this page. Most of them are really good, and will save you a ton of time figuring things out the hard way.