Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

is this correct?

Discussion in 'Scripting' started by renman3000, Apr 9, 2013.

  1. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,683
    Why would this not create correctly if auxWpnName is correct and the location is correct?


    Code (csharp):
    1.  
    2. auxWpn = Instantiate(Resources.Load("auxWpns/" + auxWpnName));
    3.  
     
  2. GuitarJonas

    GuitarJonas

    Joined:
    Sep 28, 2011
    Posts:
    226
    What are you trying to do?

    -Jonas Rasmussen
     
  3. raybarrera

    raybarrera

    Joined:
    Nov 20, 2010
    Posts:
    207
    if you're trying to get the path "resources/auxWpens/" then yes, it should be what you want.
     
  4. CyberFox01

    CyberFox01

    Joined:
    Oct 5, 2012
    Posts:
    23
    As stated above but even clearer: This method will only work if the file is in a folder called "Resources". You can have subfolders and it'll still work.
     
  5. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,683
    Thanks,
    Sorry. It was late and I had misnamed the directory. I missed a folder.

    Cheers!!!