
OnEnable method – line 343 in RFPS 1.22, line 319 in RFPS 1.21: (for RFPS 1.23, see below) if (AmmoText1 != null) AmmoText1.uiText = GetComponentInChildren() įor RFPS 1.23+, you’ll need to add an OnEnable method. Start method – line 715 in RFPS 1.23+, line 257 in RFPS 1.22, line 234 in RFPS 1.21: if (AmmoText1 != null) AmmoText1.uiText = GetComponentInChildren() Line 51 in RFPS 1.23+, Line 39 in RFPS 1.21-1.22: if (uiText != null) uiText.text = ammoGui.ToString() + (showMags ? " / " + ammoGui2.ToString() : string.Empty) ĥ. Line 30 in RFPS 1.23+, Line 19 in RFPS 1.21-1.22: public UnityEngine.UI.Text uiText = null Then, in the Start() and SwitchWeapon() methods in WeaponBehaviour.cs, set AmmoText’s Text element. In AmmoText.cs’s Update() method, set the Text element’s text value to ammoGui.ToString(). Add a public variable for it to AmmoText.cs. To do this, it needs a reference to the Text element.
#REALISTIC FPS PREFAB UNITY 5 UPDATE#
Instead, AmmoText should update the Text element on your weapon’s canvas. Set their colors to 0 to make them invisible.Ĥ. For example, if you pickup a weapon, it becomes available as a weapon you can use to shoot using Food will reduce your players.

It provides the following items: Weapons Ammunition Food Drinks HealthPacks These items all work with the setup of RFPSP. The RFPS player prefab loads a HUD prefab named AmmoText that contains two GUITexts, one for the main counter text and a child for the drop shadow. This integration provides components that work with the RFPSP asset. If you don’t want to show an ammo count (such as for a knife or flashlight), don’t add a canvas to the weapon.ģ.

You can use a screen space canvas if you don’t want it positioned on the gun. World space means it’s rooted to a position on the gun, rather than overlaying the screen in screen space.

This page contains an unofficial “how-to” for using the new Unity UI to show ammo text in Azuline Studios’ Realistic FPS Prefab (RFPS). (Realistic FPS Prefab is developed by Azuline Studios.)ġ.
