Change cube texture

Hey!

I have a cube that changes texture when you click it.
Im using gameObject.renderer.material.mainTexture = texture;

How would i make it so when it get changed by any player everybody
can see the change not only the specific player that clicks on it.

Anybody that can help or got any advice?

Comments

  • Im willing to pay anybody that could help me with this problem!
  • This will help and safe some money :)
    http://doc.exitgames.com/photon-cloud/M ... 0Tutorials
  • Tobias wrote:

    So i should be using photonview? but im using the bootcamp demo and i can't add photonview in there?
  • Thanks for posting a link to that tutorial but i don't really understand it.

    I have this
    public class ChangeColor : MonoBehaviour 
    {
        private bool radioStatus = false;
    	public Texture playeringTexture;
    	public Texture stoppedTexture;
    	
    	void OnMouseDown () 
    	{
    		RadioColorStatus();
    	}
    	
    	[RPC]
    	void RadioColorStatus ()
    	{
    		if(radioStatus == false)
    		{
    		    gameObject.renderer.material.mainTexture = playeringTexture;
    			radioStatus = true;
    		}
    		else
    		{
    			gameObject.renderer.material.mainTexture = stoppedTexture;
    			radioStatus = false;
    		}
    	}
    }
    

    How would i go ahead and use the RPC so all players can see the change?

    Isn't this how i should do it?. So the player changes the texture and sends it to
    the server and then the server sends it to all other players?. I just need some help!
    64fbwz.png
  • If you would just follow the tutorial, you would learn how the RPCs work and how you could use them to trigger a new texture on all clients.
    In this scenario, the (photon) server completely ignored, cause PUN makes clients communicate with each other.

    I don't know what I could add to the tutorial, to make it easier, sorry.