- Home /
Question by
Kriegeryt · Jul 20, 2016 at 08:58 PM ·
multiplayer-networkingmanagerweapon system
error CS0117: `Util' does not contain a definition for `SetLayerRecursively
I have been trying to follow along with a youtube tutorial by Brackeys. i have used different textures and models than the one in his tutorials. The error " error CS0117: Util' does not contain a definition for
SetLayerRecursively" has keep popping up. Any ideas would be appreciated!
using UnityEngine; using UnityEngine.Networking;
public class WeaponManager : NetworkBehaviour {
[SerializeField]
private string weaponLayerName = "Weapon";
[SerializeField]
private Transform weaponHolder;
[SerializeField]
private PlayerWeapon primaryWeapon;
private PlayerWeapon currentWeapon;
private WeaponGraphics currentGraphics;
void Start ()
{
EquipWeapon(primaryWeapon);
}
public PlayerWeapon GetCurrentWeapon ()
{
return currentWeapon;
}
public WeaponGraphics GetCurrentGraphics()
{
return currentGraphics;
}
void EquipWeapon (PlayerWeapon _weapon)
{
currentWeapon = _weapon;
GameObject _weaponIns = (GameObject)Instantiate(_weapon.graphics, weaponHolder.position, weaponHolder.rotation);
_weaponIns.transform.SetParent(weaponHolder);
currentGraphics = _weaponIns.GetComponent<WeaponGraphics>();
if (currentGraphics == null)
Debug.LogError("No WeaponGraphics component on the weapon object: " + _weaponIns.name);
if (isLocalPlayer)
Util.SetLayerRecursively(_weaponIns, LayerMask.NameToLayer(weaponLayerName));
}
}
Comment
Your answer
Follow this Question
Related Questions
PhotonNetwork RPC not working when disabling/enabling components 0 Answers
OnStart ___ vs OnLobbyStart ___ methods from NetworkManager and NetworkLobbyManager 1 Answer
Null reference Error in UNET 1 Answer
how to find local player in multiplayer game? 2 Answers
Need help with having random generation on object sync'ed across multiplayer game 1 Answer