Able to completele disable enable-disable mesh renderers, skined mesh renderers, etc on nobs - V2 #764
Closed
SnaiperoG3D
started this conversation in
Feature Request
Replies: 1 comment
-
I don't believe there is a need to add this built in, which would also mean adding more inspector options (which can be annoying for many). You can easily do this using your own scripts by unchecking Update Host Visibility on the ObserverManager, then making a script such as this and add it to your object. public class ClientHostRendererCustomizer : NetworkBehaviour
{
private Renderer[] _renderers;
public override void OnStartClient()
{
UpdateRenderers(visible: true);
}
public override void OnStopClient()
{
UpdateRenderers(visible: false);
}
private void UpdateRenderers(bool visible)
{
if (_renderers == null)
//This is where you decide what to get.
_renderers = GetComponentsInChildren<Renderer>();
//Update only the first two renderers. This is where you would apply what you wanted.
for (int i = 0; i < _renderers.Length; i++)
{
if (i >= 2)
break;
_renderers[i].enabled = visible;
}
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Continue of this post: #325
I have a problem in my game with disable/enable renderer componets via fish. In my case i have a player prefab, this prefab hold a lot of weapons, clothers, etc. I do disable/enable gameobjects and renderer components by myself, when player wanna take in hands some weapon or put clother on etc. But fish also do some stuff, and as a result i have an issue when player invisible, because fish disable renderer componets by itself, and i believe that fish doesnt know what to enable.
Anyway, I did one fix for this long time ago, and its still worthit cuz this situation still present in all fish versions.
full script: https://pastebin.com/0F9kPNLz
Changes:
add new var
and simply return everywhere when fish wanna change renderer components
UpdateRenderers, SetRenderersVisible, UpdateRenderers_Internal methos in the beginning
Beta Was this translation helpful? Give feedback.
All reactions