Cannot convert serializedObject to float

I’m trying to create a custom inspector, so this is a short version of what I have:

using UnityEngine;
using System.Collections;
using UnityEditor;

public class SomeScriptEditor : Editor {

    SerializedProperty someFloat;

    void OnEnable() {
    someFloat = serializedObject.FindProperty ("someFloat");


    public override void OnInspectorGUI() {
    EditorGUILayout.FloatField(someFloat, new GUIContent("Hello"));



But it doesn’t work. It says it can’t convert serialized property to float (EditorGUILayout.FloatField line). EditorGUILayout.PropertyField works, but why doesn’t it work for me, but it does on the live training video?

It has been a while since I wrote an editorscript but I think you need to use someFloat.floatValue to get the actual float value type needed in your FloatField.

EditorGUILayout.FloatField(someFloat.floatValue, new GUIContent("Hello"));