how many of these objects are there? more than one instance of that object or not?
are you talking about switching the material or switching the texture used in the material? the latter will cause the material to be cloned (a new material to be created - using more ram) if I understand correctly.
therefore, am I right in thinking switching the material, i.e. assigning a different material rather than changing the texture used in the material would be a better option?
what would be the best way of doing that? I don’t see a setMaterial command…
maybe loading the material from the resources folder and using "renderer.material = " ?
all my effects share one texture atlas, and one material, I ping pong the alpha of this shared material as simulating glow. this makes all effects on screen to glow in one swoop
Material yourMaterial = (Material)Resources.Load("MaterialName", typeof(Material));
yourObject.renderer.sharedMaterial = yourMaterial;
I am newbie to unity please help me out form this, i am trying to make a unlimited 2d runner game and i have 5 environments to swap as per the user selection, on the play button event i am calling the “SetTheBackground()” method out of 9 bgs only one got effected. (may be the problem is in single frame it has been called). if i kept the folowwing code in update method it’s working but fps issue.
we should not call in every frame. please help me out.
using UnityEngine;
using System.Collections;
public class BackgroundManager : MonoBehaviour {
public static BackgroundManager instance;
GameObject mgameObject;
public Material[ ] bgmaterial;