Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


GetFloat

Get a named float value.
Read time 1 minuteLast updated 4 days ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule

GetFloat(string)

Get a named float value.
public float GetFloat(string name)

Parameters

name

The name of the property.

Returns

Type

Description

float

Remarks

Examples

using UnityEngine;public class Example : MonoBehaviour{ void Start() { Renderer rend = GetComponent<Renderer> (); rend.material.shader = Shader.Find("Specular"); print(rend.material.GetFloat("_Shininess")); }}

GetFloat(int)

Get a named float value.
public float GetFloat(int nameID)

Parameters

nameID

The name ID of the property retrieved by Shader.PropertyToID.

Returns

Type

Description

float

Remarks

Examples

using UnityEngine;public class Example : MonoBehaviour{ void Start() { Renderer rend = GetComponent<Renderer> (); rend.material.shader = Shader.Find("Specular"); print(rend.material.GetFloat("_Shininess")); }}