Ok I’ve been stuck on this for hours. For some strange reason I cannot for the life of me access the length of an array with the given example in the scripting reference.
here is the snippet of the code.
public override bool ShootAt(Vector3 location)
{
switch( ProjectilePrefab.Type )
{
case EProjectileType.Instant:
{
if( !CanFire( ) ) return( false );
FireRateCooldown = FireRate;
CurrentAmmo -= AmmoConsumption;
int[] testArray = new int[5];
RaycastHit[] test = new RaycastHit[20];
Ray ray = GenerateRaycast();
RaycastHit[] hits;
hits = Physics.RaycastAll(ray.origin, ray.direction, ProjectilePrefab.Range);
for( int i = 0; i < hits.length; i++)
{
//blah blah blah
}
}
for some reason unknown to me I get this compiler error:
Assets/source/proto_code/PrimaryWeapon.cs(109,66): error CS1061: Type UnityEngine.RaycastHit[]' does not contain a definition for
length’ and no extension method length' of type
UnityEngine.RaycastHit’ could be found (are you missing a using directive or an assembly reference?)