How can I change the ship color?

I’m working with Marco Vale’s 3D Pirate ship model in AhoyMatey. I want to change the color of the ship or it’s sails to red but I’m having difficulty finding the right shader. I can see that both the sales and the boat have a shader called pirateDiff and that there’s a Main Color setting that will change the overall color. However, I can’t seem to find the right code to change it when a player joins multiplay.

Anyone had any luck with this?

	public override void OnStartLocalPlayer() { 
		GetComponentInChildren<Camera> ().enabled = true; 
		GetComponentInChildren<AudioListener> ().enabled = true;
		GetComponentInChildren<MeshRenderer>(pirateDiff).material.color = Color.red; 
	}

I haven’t been using the provide ship but I saw your post this morning and wanted to tackle this as I had the same idea for my version as well.

    Color newSailColor = new Color(Random.value, Random.value, Random.value);
    Renderer sail_colors = GetComponent<Renderer>();
    sail_colors.material.color = newSailColor;

I put this on the sails themselves within the start method and it produces this:

1 Like

Yeah, that totally worked. I didn’t even think of putting a separate script on the sales; makes sense. :slight_smile:
Thanks for your help.

That’s okay glad it’s working for you.

Privacy & Terms