Hi guys, basically the idea is that I want to let the user to download a photosphere jpg and update the inverted sphere game object at runtime.
I’ve gotten the inverted sphere game object and camera setup part done, but i just can’t replace the game object’s material at runtime… i’m experimenting with GetComponent and SetPropertyBlock but i can’t get them to work properly.
Note: You did not specify which language you are using, so my examples will be in Js, although you shouldn’t have much trouble converting if you’re using C#.
Assuming you just want to replace the material:
var targetMat : Material;
private var rend : Renderer;
function Start () {
rend = GetComponent.(Renderer);
rend.material = targetMat;
}
Assuming you just want to replace the main texture:
var targetTex : Texture;
private var rend : Renderer;
function Start () {
rend = GetComponent.(Renderer);
rend.material.mainTexture = targetTex;
}
Note: These are merely examples and will obviously need to be modified to work correctly in your project.
Also, if you need to change other textures in the material you will have to search up how to access those specific slots.
One more thing: Make sure when asking for help to show what code you currently have / have tried, and specify the programming language you are using.