View PrefabInstantiateSample.cs
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
/// <Summary> | |
/// Prefabからオブジェクトを生成するサンプルスクリプトです。 | |
/// </Summary> | |
public class PrefabInstantiateSample : MonoBehaviour | |
{ | |
// オブジェクトを生成する元となるPrefabへの参照を保持します。 |
View FpsSetTest.cs
void Start() | |
{ | |
Application.targetFrameRate = 60; | |
} |
View FpsChecker.cs
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using TMPro; | |
/// <Summary> | |
/// シーンのフレームレートを計測して画面に表示するスクリプトです。 | |
/// </Summary> | |
public class FpsChecker : MonoBehaviour | |
{ |
View GetComponentTarget.cs
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
/// <Summary> | |
/// GetComponentを使用して他のスクリプトからメソッドを呼び出します。 | |
/// </Summary> | |
public class GetComponentTarget : MonoBehaviour | |
{ | |
void Start() |
View GetComponentCaller.cs
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
/// <Summary> | |
/// GetComponentを使用して他のスクリプトのメソッドを呼び出します。 | |
/// </Summary> | |
public class GetComponentCaller : MonoBehaviour | |
{ | |
public GameObject targetObj; |
View IEventCaller.cs
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.EventSystems; | |
/// <Summary> | |
/// EventSystemsで使用するインタフェースです。 | |
/// </Summary> | |
public interface IEventCaller : IEventSystemHandler | |
{ |
View EventSystemsTarget.cs
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
/// <Summary> | |
/// EventSystemsを使用してメソッドを呼び出されるスクリプトです。 | |
/// </Summary> | |
public class EventSystemsTarget : MonoBehaviour, IEventCaller | |
{ | |
void Start() |
View EventSystemsCaller.cs
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.EventSystems; | |
/// <Summary> | |
/// EventSystemsを使用して他のスクリプトのメソッドを呼び出します。 | |
/// </Summary> | |
public class EventSystemsCaller : MonoBehaviour | |
{ |
View SendMessageTarget.cs
/// <Summary> | |
/// SendMessageで処理が呼び出されるメソッドです。 | |
/// </Summary> | |
public class SendMessageTarget : MonoBehaviour | |
{ | |
/// <Summary> | |
/// SendMessageを使って対象のスクリプトの処理を呼び出します。 | |
/// </Summary> | |
public void ShowLog() | |
{ |
View SendMessageCaller.cs
/// <Summary> | |
/// SendMessageを使って対象のスクリプトの処理を呼び出します。 | |
/// </Summary> | |
public class SendMessageCaller : MonoBehaviour | |
{ | |
public GameObject targetObj; | |
void Start() | |
{ | |
targetObj.SendMessage("ShowLog"); |
NewerOlder