how to create instance in Unity
Posted On 2012 年 4 月 9 日
#1 Create Class Car.
using UnityEngine; using System.Collections; public class Car : ScriptableObject { public string color; void Awake(){ color = "red"; } } |
#2 Create instance.
using UnityEngine; using System.Collections; public class main : MonoBehaviour { void Start(){ Car polo = (Car) ScriptableObject.CreateInstance(typeof(Car)); } } |