2D グラフィックスのスプライトをレンダリング
//This example outputs Sliders that control the red green and blue elements of a sprite's color //Attach this to a GameObject and attach a SpriteRenderer component
using UnityEngine;
public class Example : MonoBehaviour { SpriteRenderer m_SpriteRenderer; //The Color to be assigned to the Renderer’s Material Color m_NewColor;
//These are the values that the Color Sliders return float m_Red, m_Blue, m_Green;
void Start() { //Fetch the SpriteRenderer from the GameObject m_SpriteRenderer = GetComponent<SpriteRenderer>(); //Set the GameObject's Color quickly to a set Color (blue) m_SpriteRenderer.color = Color.blue; }
void OnGUI() { //Use the Sliders to manipulate the RGB component of Color //Use the Label to identify the Slider GUI.Label(new Rect(0, 30, 50, 30), "Red: "); //Use the Slider to change amount of red in the Color m_Red = GUI.HorizontalSlider(new Rect(35, 25, 200, 30), m_Red, 0, 1);
//The Slider manipulates the amount of green in the GameObject GUI.Label(new Rect(0, 70, 50, 30), "Green: "); m_Green = GUI.HorizontalSlider(new Rect(35, 60, 200, 30), m_Green, 0, 1);
//This Slider decides the amount of blue in the GameObject GUI.Label(new Rect(0, 105, 50, 30), "Blue: "); m_Blue = GUI.HorizontalSlider(new Rect(35, 95, 200, 30), m_Blue, 0, 1);
//Set the Color to the values gained from the Sliders m_NewColor = new Color(m_Red, m_Green, m_Blue);
//Set the SpriteRenderer to the Color defined by the Sliders m_SpriteRenderer.color = m_NewColor; } }
| adaptiveModeThreshold | The current threshold for Sprite Renderer tiling. |
| color | スプライトグラフィックスのレンダリングする際のカラー |
| drawMode | スプライトレンダラーの現在の描画モード |
| flipX | スプライトを X 軸で反転します |
| flipY | スプライトを Y 軸で反転します |
| maskInteraction | Specifies how the sprite interacts with the masks. |
| size | Property to set/get the size to render when the SpriteRenderer.drawMode is set to SpriteDrawMode.Sliced. |
| sprite | レンダリング対象のスプライト |
| spriteSortPoint | Determines the position of the Sprite used for sorting the SpriteRenderer. |
| tileMode | The current tile mode of the Sprite Renderer. |
| RegisterSpriteChangeCallback | Registers a callback to receive a notification when the SpriteRenderer's Sprite reference changes. |
| UnregisterSpriteChangeCallback | Removes a callback (that receives a notification when the Sprite reference changes) that was previously registered to a SpriteRenderer. |
| gameObject | このコンポーネントはゲームオブジェクトにアタッチされます。コンポーネントはいつもゲームオブジェクトにアタッチされています。 |
| tag | ゲームオブジェクトのタグ |
| transform | The Transform attached to this GameObject. |
| hideFlags | Should the object be hidden, saved with the Scene or modifiable by the user? |
| name | オブジェクト名 |
| allowOcclusionWhenDynamic | Controls if dynamic occlusion culling should be performed for this renderer. |
| bounds | The bounding box of the renderer in world space. |
| enabled | 有効にした場合、レンダリングされた 3D オブジェクトが表示されます |
| forceRenderingOff | Allows turning off rendering for a specific component. |
| isPartOfStaticBatch | Indicates whether the renderer is part of a static batch with other renderers. |
| isVisible | カメラにレンダラーが表示されているか(読み取り専用) |
| lightmapIndex | このレンダラーに適用されるベイクされるライトマップのインデックス |
| lightmapScaleOffset | UV スケールとオフセットをライトマップに使用します。 |
| lightProbeProxyVolumeOverride | これを設定すると、レンダラーはソースのゲームオブジェクトにアタッチされた ライトプローブプロキシボリューム コンポーネントを使用します。 |
| lightProbeUsage | ライトプローブ補間のタイプ |
| localBounds | The bounding box of the renderer in local space. |
| localToWorldMatrix | ローカル座標からワールド座標へ変換した行列(読み取り専用) |
| material | レンダラーに割り当てられている最初にインスタンス化された Material を返します。 |
| materials | このオブジェクトのすべてのインスタンス化されたマテリアルを返します。 |
| motionVectorGenerationMode | Specifies the mode for motion vector rendering. |
| probeAnchor | 設定する場合、レンダラーはライトプローブや反射プローブを見つけるためにこの Transform の位置を使用します。 |
| rayTracingMode | Describes how this renderer is updated for ray tracing. |
| realtimeLightmapIndex | The index of the real-time lightmap applied to this renderer. |
| realtimeLightmapScaleOffset | The UV scale & offset used for a real-time lightmap. |
| receiveShadows | このオブジェクトが影の影響を受けるかどうか |
| reflectionProbeUsage | 反射プローブはこのレンダラーのために使用する必要があるか。 |
| rendererPriority | This value sorts renderers by priority. Lower values are rendered first and higher values are rendered last. |
| renderingLayerMask | Determines which rendering layer this renderer lives on. |
| shadowCastingMode | このオブジェクトが影をキャストするかどうか |
| sharedMaterial | このオブジェクトの共有マテリアル |
| sharedMaterials | このオブジェクトのすべての共有マテリアル |
| sortingLayerID | レンダラーの Sorting Layer の Unique ID |
| sortingLayerName | レンダラーの Sorting Layer の名前 |
| sortingOrder | Sorting Layer によるレンダラーのオーダー順 |
| staticShadowCaster | Is this renderer a static shadow caster? |
| worldToLocalMatrix | ワールド座標からローカル座標へ変換した行列(読み取り専用) |
| BroadcastMessage | ゲームオブジェクトまたは子オブジェクトにあるすべての MonoBehaviour を継承したクラスにある methodName 名のメソッドを呼び出します。 |
| CompareTag | Checks the GameObject's tag against the defined tag. |
| GetComponent | Returns the component of type if the GameObject has one attached. |
| GetComponentInChildren | Returns the Component of type in the GameObject or any of its children using depth first search. |
| GetComponentInParent | Returns the Component of type in the GameObject or any of its parents. |
| GetComponents | GameObject から type のタイプのコンポーネントを「すべて」取得します。 |
| GetComponentsInChildren | Returns all components of Type type in the GameObject or any of its children using depth first search. Works recursively. |
| GetComponentsInParent | GameObject や深さ優先探索を活用して、親子関係にある親オブジェクトから type のタイプのコンポーネントを「すべて」取得します。 |
| SendMessage | ゲームオブジェクトにアタッチされているすべての MonoBehaviour にある methodName と名付けたメソッドを呼び出します |
| SendMessageUpwards | ゲームオブジェクトと親(の親、さらに親 ... )にアタッチされているすべての MonoBehaviour にある methodName と名付けたメソッドを呼び出します |
| TryGetComponent | Gets the component of the specified type, if it exists. |
| GetInstanceID | Gets the instance ID of the object. |
| ToString | Returns the name of the object. |
| GetClosestReflectionProbes | 重みを持つ最も近い反射プローブの配列を返します。重みはプローブがレンダラーでどのくらい影響するかを示しています。反射プローブが発生する間のブレンドにもこの値が使用されます。 |
| GetMaterials | このオブジェクトのすべてのインスタンス化されたマテリアルを返します。 |
| GetPropertyBlock | Get per-Renderer or per-Material property block. |
| GetSharedMaterials | Returns all the shared materials of this object. |
| HasPropertyBlock | Returns true if the Renderer has a material property block attached via SetPropertyBlock. |
| ResetBounds | Reset custom world space bounds. |
| ResetLocalBounds | Reset custom local space bounds. |
| SetPropertyBlock | Lets you set or clear per-renderer or per-material parameter overrides. |
| Destroy | Removes a GameObject, component or asset. |
| DestroyImmediate | Destroys the object obj immediately. You are strongly recommended to use Destroy instead. |
| DontDestroyOnLoad | Do not destroy the target Object when loading a new Scene. |
| FindObjectOfType | タイプ type から最初に見つけたアクティブのオブジェクトを返します |
| FindObjectsOfType | Gets a list of all loaded objects of Type type. |
| Instantiate | original のオブジェクトをクローンします |
| bool | オブジェクトが存在するかどうか |
| operator != | 二つのオブジェクトが異なるオブジェクトを参照しているか比較します |
| operator == | 2つのオブジェクト参照が同じオブジェクトを参照しているか比較します。 |
| OnBecameInvisible | "OnBecameInvisible" は任意のカメラでオブジェクトが表示されなくなるときに呼び出されます。 |
| OnBecameVisible | "OnBecameVisible" は任意のカメラでオブジェクトが見えるようになったときに呼び出されます。 |