laurenz

Custom Inspector 1

Basics and Setup

Custom Inspectors are a powerful tool to create a custom interface for your scripts. This can be used to make the inspector more user-friendly, to hide certain variables or to create a custom interface for your script. In this tutorial, we will create a custom inspector for a simple script that changes the color of the object it is attached to. We will create a custom interface to change the color of the object in the inspector.


                    // Function that gets called when item is collected
        public void OnItemCollected(OrbitingItem item)
        {
            Debug.Log("Item collected : " + item.data.name);
            collectedItemDatas.Add(item.data);
            orbitingPoints.Remove(orbitingPoints.Find(x => x.transform == item.transform));
            Destroy(item.gameObject);
        }