Missing type/namespaces do not allow me to playtest?
Main problem: A first-person combat prototype that I'm working on has run into a snag. Some of the names that I'm using in a script are stopping me from playtesting the game. The script in question is a Weapon.cs
script that's based on the Creator Kit: FPS project's own script of the same name. I'm using this script to separate the weapon/ability scripting from the player movement control of the FPSController.cs
script.
Aside: I am currently using Visual Studio 2019, which...the current version that I have seems to be missing something vital to Unity development, because it's missing some of the namespaces that I need for Unity C# scripting.
Current Weapon.cs
script (based on Creator Kit: FPS):
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UI;
#if UNITY_EDITOR
using UnityEditor;
#endif
public class Weapon : MonoBehaviour
{
static RaycastHit[] s_HitInfoBuffer = new RaycastHit[8];
public enum TriggerType
{
Auto,
Manual
}
public enum WeaponType
{
Raycast,
Projectile
}
public enum WeaponState
{
Idle,
Firing,
Reloading
}
[System.Serializable]
public class AdvancedSettings
{
public float spreadAngle = 0.0f;
public int projectilePerShot = 1;
public float screenShakeMultiplier = 1.0f;
}
public TriggerType triggerType = TriggerType.Auto;
public WeaponType weaponType = WeaponType.Projectile;
public float fireRate = 0.5f;
public float reloadTime = 2.0f;
public int clipSize = 9;
public float damage = 1.0f;
[AmmoType]
public int ammoType = -1;
public Projectile projectilePrefab;
public float projectileLaunchForce = 200.0f;
public Transform EndPoint;
public AdvancedSettings advancedSettings;
[Header("Audio Clips")]
public AudioClip FireAudioClip;
public AudioClip ReloadAudioClip;
[Header("Visual Settings")]
public LineRenderer PrefabRayTrail;
[Header("Visual Display")]
public AmmoDisplay AmmoDisplay;
public bool triggerDown
{
get { return m_TriggerDown; }
set
{
m_TriggerDown = value;
if (!m_TriggerDown) m_ShotDone = false;
}
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
//public GameObject shot;
//public Transform shotSpawn;
//public float fireRate;
//private float nextFire;
//if (Input.GetButton("Fire2") && Time.time > nextFire)
//{
// nextFire = Time.time + fireRate;
// Instantiate(shot, shotSpawn.position, shotSpawn.rotation);
//}
Console log:
do you have the scripts that are missing? or you only copied that script?
I'm adding from the $$anonymous$$it's script piece by piece, but I'm not sure if I understood the question. What would either case mean for the project?
All the ammo classes are missing in your project so you skipped when they add It in the tutorial