Search Unity

method returning arrays of transforms - how to ?

Discussion in 'Editor & General Support' started by llavigne, Mar 4, 2008.

  1. llavigne

    llavigne

    Joined:
    Dec 27, 2007
    Posts:
    977
    I am compiling this code and Unity speaks like Yoda : "Not all code paths return a value..."

    What I am trying to do is have FindTargets () return an array of transform...

    Code (csharp):
    1.  
    2. using System;
    3.  
    4. using System.Collections;
    5.  
    6. using UnityEngine;
    7.  
    8.  
    9.  
    10.  
    11.  
    12. class Targetter
    13.  
    14. {
    15.  
    16.     Transform[] FindTargets(string type , Vector3 position, float radius, bool findCloaked)
    17.  
    18.     {
    19.  
    20.  
    21.  
    22.     }
    23.  
    24. }
    25.  
    26.  
     
  2. bronxbomber92

    bronxbomber92

    Joined:
    Nov 11, 2006
    Posts:
    888
    Please post the code for the FindTargets() method, instead of leaving it blank.
     
  3. llavigne

    llavigne

    Joined:
    Dec 27, 2007
    Posts:
    977
    problem solved, thanks. Also I use classes now to pass parameters. works like a charm and quite powerful.