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
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
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")); }}