unity listarray code example
Example 1: unity createassetmenu
using UnityEngine;
using System.Collections;
[CreateAssetMenu(fileName = "Data", menuName = "Inventory/List", order = 1)]
public class MyScriptableObjectClass : ScriptableObject {
public string objectName = "New MyScriptableObject";
public bool colorIsRandom = false;
public Color thisColor = Color.white;
public Vector3[] spawnPoints;
}
Example 2: setparent unity
using UnityEngine;public class ExampleClass : MonoBehaviour
{
public GameObject child; public Transform parent;
public void Example(Transform newParent)
{
child.transform.SetParent(newParent);
child.transform.SetParent(newParent, false);
child.transform.SetParent(null);
}
}