Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
[ScriptedImporter(1, "cube")]
public class PrimitiveImporter : ScriptedImporter
public PrimitiveType type = PrimitiveType.Cube;
public override void OnImportAsset(AssetImportContext ctx)
var cube = GameObject.CreatePrimitive(type);
cube.transform.localScale = new Vector3(1, 1, 1);
var material = new Material(Shader.Find("Standard")); = "Cube Material";
cube.GetComponent<MeshRenderer> ().material = material;
var scale = JsonUtility.FromJson<Vector3>(File.ReadAllText(ctx.assetPath));
cube.transform.localScale = scale;
}catch (System.Exception e) {
Debug.LogError (e.Message, cube);
ctx.AddObjectToAsset("mat", material);
ctx.AddObjectToAsset("CUBE", cube);

This comment has been minimized.

Copy link
Owner Author

tsubaki commented Dec 13, 2017

animation 64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.