I have a developer console system that I have set up, and I have gotten it to recognise commands properly. My issue now is the code I am using to spawn a “testlight” (spotlight) doesn’t seem to want to behave properly.
I get this error:
Error CS0118: ‘UnityEngine.Object.Instantiate(UnityEngine.Object, UnityEngine.Vector3, UnityEngine.Quaternion)’ is a ‘method’ but is used like a ‘type’
from mono, but this error:
“Object reference not set to an instance of an object”
and this error:
error CS0426: The nested type Instantiate' does not exist in the type
UnityEngine.GameObject’
from unity. This is the code for that section below.
public static CharacterController KGCC;
public static void spawnSpot()
{
GameObject TestSpot;
TestSpot = new GameObject.Instantiate(TestSpot, KGCC.transform.position, KGCC.transform.localRotation) as Light; // error on this line
TestSpot.AddComponent();
TestSpot.light.color = Color.white;
TestSpot.light.type = LightType.Spot;
TestSpot.light.spotAngle = (160);
TestSpot.transform.position = KGCC.transform.position;
}
can someone provide an example of the proper way to go about this please?