offset And Tiling in Unity

Create a plane in unity.

add Standart material and assign a image in Main Maps / Albedo.

Image:

your material in inspector:

to make it moving along the plane, create the following C# script.

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class offsetTillingPlane : MonoBehaviour {

public float scrollSpeed = 0.5F;

Renderer rend;

// Use this for initialization

void Start () {
rend = GetComponent<Renderer>();

}

// Update is called once per frame
void Update () {

float offset = Time.time * scrollSpeed;
rend.material.mainTextureOffset = new Vector2(offset, 0);
       }
}

attach the script to the plane (Pres Play)

 

Unity instantiate random prefab

//How to Instantiate difference prefab at runtime in Unity.

//Create a C# script and create a array

public GameObject[] prefeb;
//go in inspector in unity set size and drag the prefabs to the Element.
//create a function in same script and call it
void createdifobjects()
{
int prefeb_num = Random.Range(0, 3);
Instantiate(prefeb[prefeb_num], this.transform.position , this.transform.rotation);
}