Author Topic: Utility script, friend of TNAutoCreate: TNAutoDisableOthers  (Read 1971 times)

toqueteos

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 13
    • View Profile
Utility script, friend of TNAutoCreate: TNAutoDisableOthers
« on: November 21, 2013, 07:41:51 AM »
Hi there fellow TNet users!

I've made this script to auto disable components on all other players (tno.isMine == false) whenever they are created using TNManager.Create.
It's TNAutoCreate's best friend, it has almost the same interface as TNAutoSync, just add components (from the object you attached the script or any of its children) and they'll get disabled on other clients.

Use case: each client will get their hierarchy populated with other players avatar's, this will have scripts and components you don't want to apply on every client (Camera, movement scripts and such)

Here's the code:
https://gist.github.com/toqueteos/3770f2cea1ad48e6fd02
IMPORTANT The TNAutoDisableOthersInspector.cs script needs to be inside an Editor folder otherwise it won't work. Using the .unitypackage file is easier.

Here's a .unitypackage file:
https://www.dropbox.com/s/vp8i59vjl0aitoc/TNET_AutoDisableOthers.unitypackage


Hope you like it!

Any suggestions, bugs or enhancement proposals are welcome.
« Last Edit: November 22, 2013, 09:54:10 AM by toqueteos »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Utility script, friend of TNAutoCreate and TNAutoSync: TNAutoDisableOthers
« Reply #1 on: November 21, 2013, 01:32:13 PM »
Thanks for sharing!