Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by MihajloNen · May 17, 2016 at 09:07 PM · materialnetworksynchronizationnetworkviewclient-server

Synchronize different prefab material over the network?

I am currently running into the following noob question while using the uNet-networking system: I have a player model prefab which is setup all right and I have a material selection menu where the players can choose their favorite color, let's say REDmetal or BLUEmetal and a default GREENmetal. I get it so far that the local player works fine. everyone chooses his/her material and sees his own player in the right color in the network scene, BUT ALL THE OTHER PLAYERS REMAIN THE DEFAULT GREENmetal... I have tried [SyncVar] and [Command], [ClientRpc]-stuff, but nothing really helpes. The material is never synchronized for the view of other players.

I am really new to networking and struggling since days. Hope for help here :)

 [SerializeField]
 private Material ShipMat_one;
 [SerializeField]
 private Material ShipMat_two;
 [SerializeField]
 private Material ShipMat_three;
 [SerializeField]
 private Material ShipMat_four;
 [SerializeField]
 private Material ShipMat_enemy;

 [SerializeField]
 private Material WingMat_one;
 [SerializeField]
 private Material WingMat_two;
 [SerializeField]
 private Material WingMat_three;
 [SerializeField]
 private Material WingMat_four;
 [SerializeField]
 private Material WingMat_enemy;
 [SyncVar]
 public GameObject Ship;
 [SyncVar]
 public GameObject Wings;

 void Update()
 {
     ApplyMaterial ();
 }

 void ApplyMaterial()
 {
     if (isLocalPlayer) 
     {
         if (CharacterSelecter.selectionIndex == 0) 
         {
             Ship.GetComponent<Renderer> ().material = ShipMat_one;
             Wings.GetComponent<Renderer> ().material = WingMat_one;
         }
         if (CharacterSelecter.selectionIndex == 1) 
         {
             Ship.GetComponent<Renderer> ().material = ShipMat_two;
             Wings.GetComponent<Renderer> ().material = WingMat_two;
         }
         if (CharacterSelecter.selectionIndex == 2) 
         {
             Ship.GetComponent<Renderer> ().material = ShipMat_three;
             Wings.GetComponent<Renderer> ().material = WingMat_three;
         }
         if (CharacterSelecter.selectionIndex == 3) 
         {
             Ship.GetComponent<Renderer> ().material= ShipMat_four;
             Wings.GetComponent<Renderer> ().material = WingMat_four;
         }

     }
     //this is just a possible solution for a default enemy-material
     /*
     if (!isLocalPlayer) 
     {
         Ship.GetComponent<Renderer> ().material = ShipMat_enemy;
         Wings.GetComponent<Renderer> ().material = WingMat_enemy;
     }*/
 }

}

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image MihajloNen · May 19, 2016 at 09:43 AM 0
Share

I also tried to use a $$anonymous$$aterial ans use it as a [SyncVar], but it did not synchronize through the network :-/

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

52 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Synchronizing Gameobjects over a Network Server < - > Client Sync 0 Answers

How to load all character previously in game when new player joins 0 Answers

Server & Client Instantiate 0 Answers

Supress initial OnSerializeNetworkView state update 0 Answers

Very simple networking question 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges