I know how to set a pre-fab to a variable and instantiate the object using that variable name. But is there a way for that instantiated object to then be set to another variable that way it can then be modified but other game objects.
Are you talking about code? On the inspector? Given that this is the scripting forum, I’m assuming you want code, but it sounded like an inspector question.
If it’s code, what code have you tried? It should be a simple assignment operation something like this:
public GameObject SomeThing; // accessible by inspector or any other scripts
... later, somewhere in a function...
Something = Instantiate(... some params...);
So I had tried something like that but had a mismatch been the variable type and what is created by the instantiate command. So the winning combination was:
public Transform currentFocus_Obj;
:
:
currentFocus_Obj = (Transform) Instantiate (block_obj, currentGrid ,block_obj.rotation);
Its those conversions that usually mess me up.
Thank you for your time, I appreciate it.
“But is there a way for that instantiated object to then be set to another variable that way it can then be modified but other game objects.”
I fail to understand this question, could you be a little more clear about what you are trying to achieve?