Unexpected symbol `<', expecting `identifier'

Common error, googled but can’t find an answer that works

using UnityEngine;
using System.Collections;

public class ImageFromAssets : MonoBehaviour {
	void Start (){
	// Use this for initialization
	var go = new GameObject.CreatePrimitive(PrimitiveType.Plane);
	var rend = go.GetComponent.<Renderer>();
	rend.material.mainTexture = Resources.Load("cube_0") as Texture;
	}
	
	
	// Update is called once per frame
	void Update () {
	
	}
}

If you’re using c#, I believe this line var rend = go.GetComponent.(); should be: var rend = go.GetComponent();

Hope this helps

I don’t know anything about C# or C++, but maybe this might work,

var mytextures : Texture2D[];
var which : int = 0;

function Start(){
	var go = new GameObject.CreatePrimitive(PrimitiveType.Plane);
	var rend = go.GetComponent(Renderer);
	rend.material.mainTexture = mytextures[which];
}

It’s in Java however, but it will create a Plain with the specified texture in your array

On the line with ‘GetComponent’, delete the period before the and it will work.