Class Reference in Editor not working


I didn’t really knew how to call the question or whatever this is.
I have a script called “DebugSpawner” - some script to spawn some items in the environment and two additional script called “SpawnerScript” and “DebuggingSpawner”.

You may know what I want to do but let me tell you :smiley:

The spawner has some properties to be filled. Things like

public GameObject SpawnItem;
public SpawnerScript SpawnScript;
public float SpawnTime = 1500;
public float TimeRandom = 5;
public float Radius = 10;
public float PlayerRadius = 150;

Basically there is no problem without the public SpawnerScript SpawnScript; this really doesn’t want to work like I want it to work.

If I’m assigning a script through the editor which inherits from SpawnerScript the property keeps the value of “None (SpawnerScript)”.

My SpawnerScript is like

public abstract class SpawnerScript : MonoBehaviour {

The DebuggingSpawner looks like

public class DebuggingSpawner : SpawnerScript {
	void Update () {
		Vector2 randPos = Random.insideUnitCircle;
		gameObject.transform.position += new Vector3 ( randPos.x * 5, 0, randPos.y * 5 );

Some images to show you what I’m talking about.
There you see that I’m able to select the right script but this is what is happening:

It keeps the value of “None”:


Any help for this or how I can fix it?

Your DebuggingSpawner script has to be attached to a GameObject. You can create an empty game object, attach your script to it, then it’ll be accepted in that “SpawnerScript” field. Make it a prefab if you want to use it scene to scene.