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 | SpriteRenderer.drawMode が SpriteDrawMode.NineSlice に設定されるとき、レンダリングするサイズを設定/取得するプロパティーです。 |
| sprite | レンダリング対象のスプライト |
| tileMode | The current tile mode of the Sprite Renderer. |
| gameObject | このコンポーネントはゲームオブジェクトにアタッチされます。コンポーネントはいつもゲームオブジェクトにアタッチされています。 |
| tag | ゲームオブジェクトのタグ |
| transform | The Transform attached to this GameObject. |
| hideFlags | オブジェクトは非表示、シーンに保存、ユーザーが編集可能、などを設定する。 |
| name | オブジェクト名 |
| allowOcclusionWhenDynamic | Controls if dynamic occlusion culling should be performed for this renderer. |
| bounds | レンダラーのバウンディングボリューム(読み取り専用) |
| enabled | 有効にした場合、レンダリングされた 3D オブジェクトが表示されます |
| isPartOfStaticBatch | レンダラーが静的にバッチ処理されているか |
| isVisible | カメラにレンダラーが表示されているか(読み取り専用) |
| lightmapIndex | このレンダラーに適用されるベイクされるライトマップのインデックス |
| lightmapScaleOffset | UV スケールとオフセットをライトマップに使用します。 |
| lightProbeProxyVolumeOverride | これを設定すると、レンダラーはソースのゲームオブジェクトにアタッチされた ライトプローブプロキシボリューム コンポーネントを使用します。 |
| lightProbeUsage | ライトプローブ補間のタイプ |
| localToWorldMatrix | ローカル座標からワールド座標へ変換した行列(読み取り専用) |
| material | レンダラーに割り当てられている最初にインスタンス化された Material を返します。 |
| materials | このオブジェクトのすべてのインスタンス化されたマテリアルを返します。 |
| motionVectorGenerationMode | Specifies the mode for motion vector rendering. |
| probeAnchor | 設定する場合、レンダラーはライトプローブや反射プローブを見つけるためにこの Transform の位置を使用します。 |
| realtimeLightmapIndex | このレンダラーに適用されるリアルタイムライトマップのインデックス |
| realtimeLightmapScaleOffset | リアルタイムライトマップで使用される UV スケールとオフセット |
| receiveShadows | このオブジェクトが影の影響を受けるかどうか |
| reflectionProbeUsage | 反射プローブはこのレンダラーのために使用する必要があるか。 |
| shadowCastingMode | このオブジェクトが影をキャストするかどうか |
| sharedMaterial | このオブジェクトの共有マテリアル |
| sharedMaterials | このオブジェクトのすべての共有マテリアル |
| sortingLayerID | レンダラーの Sorting Layer の Unique ID |
| sortingLayerName | レンダラーの Sorting Layer の名前 |
| sortingOrder | Sorting Layer によるレンダラーのオーダー順 |
| worldToLocalMatrix | ワールド座標からローカル座標へ変換した行列(読み取り専用) |
| BroadcastMessage | ゲームオブジェクトまたは子オブジェクトにあるすべての MonoBehaviour を継承したクラスにある methodName 名のメソッドを呼び出します。 |
| CompareTag | このゲームオブジェクトは tag とタグ付けされているかどうか |
| GetComponent | ゲームオブジェクトに type がアタッチされている場合は type のタイプを使用してコンポーネントを返します。ない場合は null です |
| GetComponentInChildren | GameObject や深さ優先探索を活用して、親子関係にある子オブジェクトから type のタイプのコンポーネントを取得します。 |
| GetComponentInParent | GameObject や深さ優先探索を活用して、親子関係にある親オブジェクトから type のタイプのコンポーネントを取得します。 |
| GetComponents | GameObject から type のタイプのコンポーネントを「すべて」取得します。 |
| GetComponentsInChildren | GameObject や深さ優先探索を活用して、親子関係にある子オブジェクトから type のタイプのコンポーネントを「すべて」取得します。 |
| GetComponentsInParent | GameObject や深さ優先探索を活用して、親子関係にある親オブジェクトから type のタイプのコンポーネントを「すべて」取得します。 |
| SendMessage | ゲームオブジェクトにアタッチされているすべての MonoBehaviour にある methodName と名付けたメソッドを呼び出します |
| SendMessageUpwards | ゲームオブジェクトと親(の親、さらに親 ... )にアタッチされているすべての MonoBehaviour にある methodName と名付けたメソッドを呼び出します |
| GetInstanceID | オブジェクトのインスタンス ID を返します |
| ToString | ゲームオブジェクトの名前を返します |
| GetClosestReflectionProbes | 重みを持つ最も近い反射プローブの配列を返します。重みはプローブがレンダラーでどのくらい影響するかを示しています。反射プローブが発生する間のブレンドにもこの値が使用されます。 |
| GetPropertyBlock | レンダラーのマテリアルプロパティーブロックを取得します |
| SetPropertyBlock | マテリアルを複製せずにマテリアルのパラメーターを変更することができます |
| Destroy | ゲームオブジェクトやコンポーネント、アセットを削除します |
| DestroyImmediate | Destroys the object obj immediately. You are strongly recommended to use Destroy instead. |
| DontDestroyOnLoad | 新しいシーンを読み込んでもオブジェクトが自動で破壊されないように設定します |
| FindObjectOfType | タイプ type から最初に見つけたアクティブのオブジェクトを返します |
| FindObjectsOfType | タイプから見つけたすべてのアクティブのオブジェクト配列を返します |
| Instantiate | original のオブジェクトをクローンします |
| bool | オブジェクトが存在するかどうか |
| operator != | 二つのオブジェクトが異なるオブジェクトを参照しているか比較します |
| operator == | 2つのオブジェクト参照が同じオブジェクトを参照しているか比較します。 |
| OnBecameInvisible | "OnBecameInvisible" は任意のカメラでオブジェクトが表示されなくなるときに呼び出されます。 |
| OnBecameVisible | "OnBecameVisible" は任意のカメラでオブジェクトが見えるようになったときに呼び出されます。 |