Octree Terrain Generator, Null Prefab Error

510842–18145–$ReviewPackage.unitypackage (61.3 KB)

I’m attaching a package because I think the problem is more likely stemming from something I did wrong in one of the other two scripts. The error reads “ArgumentException: The prefab you want to instantiate is null”. Looking it up I found the part about linking the prefab to the script instance and have definitely already done it, triple checked, then rechecked every time I got the error to make damn sure it was absolutely, definitely, beyond any doubt linked correctly in Unity’s GUI.

The script the error is in:

using UnityEngine;
using System.Collections;

public class Block: MonoBehaviour
{

	Vector3 mOrigin;
	btypes mtype;
	
	public Object Box;
	
	void Start()
	{
	}
	
	void Update()
	{
	}
	
	public Block InitBlock(Vector3 o, int t)
	{
		
		mOrigin = o;
		mtype = (btypes)t;
		
		if((btypes)t == btypes.EXAMPLE)
                    { Instantiate(Box, mOrigin, Quaternion.identity); }
		return this;
	}
}

The overall goal is to have the terrain populated by relatively small voxels allowing deformation during the game and maintaining a relatively unique look. At present moment the code should simply create a 323232 block cubes.

that means you did not assign a proper prefab to Box in your scene / before calling InitBlock