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.

Why does Photon Instantiate only work with a direct input name but not a variable?

Discussion in 'Visual Scripting' started by M_Keyla_M, Oct 18, 2021.

  1. M_Keyla_M

    M_Keyla_M

    Joined:
    Dec 24, 2014
    Posts:
    57
    Hello!

    I'm trying to instantiate an object by using a variable which contains a string of the item you're currently holding. The string in the variable is the exact same as the prefab name but once i try it out in the build version (in the unity editor it works fine) it returns an error (see image). The prefab is 100% in the Resources folder. When I remove the variable and only instantiate with just the name in the instantiate node it works! But once i connect the variable to get the string it stops working.

    the second picture shows the script when it works but it's not what i need because you need to be able to instantiate different items not just one. When i connect the variable (right next to the instantiate node) it stops working even though the name is still the same. Even using " string literal" gives me the errors!

    Does anyone know why it wont work with a variable or any other node???

    Screenshot 2021-10-18 at 09.37.55.png Screenshot 2021-10-17 at 16.18.25.png