Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 /
This question was closed Mar 30 at 03:03 PM by HeaveGames for the following reason:

Solved problem by myself

avatar image
0
Question by HeaveGames · Mar 27 at 02:30 PM · multiplayertransparency

How to make 3d object with a lot of meshes partly transparent for 1 player and for other fully transparent

Hello everyone. I hope you can help me. So i'm creating 3d multiplayer game. And I faced with couple of issues. The first issue: I have 3d model imported from blender, it consists of a lot of different meshes. How to make this model transparent? The second issue: I need this model becomes partly transparent for player who is using this model and for other players fully transparent. P.S.: I found in internet only the way of changing alpha of material of object. So in this case as I understand I would need to change alpha of all materials which are refered to model. But I'm afraid that when I change alpha of material, other players who are using same model also will become trasparent. The task is to get effect same as in mobile game "Brawl Stars" when the player is hidining in bushes, so that player becomes invisible for others and partly visible for himself. Thank you in advance!!

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 HeaveGames · Mar 30 at 03:04 PM 0
Share

Solved problem by myself by writing following script: using UnityEngine;

public class SaltOrSugar : MonoBehaviour { private Color[] startPlayerColor; private Color startObjectColor; private Material start; private Renderer [] hero;
public float transparencyOfplayer = 0.5f; public float transparencyOfobject = 0.5f;

 private void OnTriggerEnter(Collider other)
 {
     startPlayerColor = new Color[other.gameObject.transform.childCount];
     for (int i = 0; i < other.gameObject.transform.childCount; i++)
     {
         if(other.gameObject.transform.GetChild(i).tag != "MainCamera")
         startPlayerColor[i] = other.gameObject.transform.GetChild(i).gameObject.GetComponent<Renderer>().material.color;
     }
         startObjectColor = gameObject.GetComponent<Renderer>().material.color;
     if (other.gameObject.tag == "Hero")
     {           
         start = gameObject.GetComponent<Renderer>().material;
         Color starts = start.color;
         starts.a = transparencyOfobject;
         start.color = starts;

         hero = other.gameObject.GetComponentsInChildren<Renderer>();
         
         foreach (Renderer mat in hero)
         {                
             Material heromat = mat.material;
             Color hero1 = heromat.color;
             hero1.a = transparencyOfplayer;
             heromat.color = hero1;
         }
     }
 }
 private void OnTriggerExit(Collider other)
 {
     int counter = -1;
     if (other.gameObject.tag == "Hero")
     {
         start.color = startObjectColor;
         foreach(Renderer mat in hero)
         {
             counter++;
             Material heromat = mat.material;
             heromat.color = startPlayerColor[counter];
         }
     }
 }

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

224 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 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 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 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 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

Unity networking tutorial? 6 Answers

Multiplayer FPS movement and animations character 1 Answer

Access host's object 0 Answers

Making A Chat System 0 Answers

Problem with UFPS and photon 1 Answer


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