- Home /
Can I have a private Variable "look" in folder?
Hey guys,
Is there a way to have a Private Variable look into my sprites folder and find a specific sprite by using it's name or something? Or if I can assign it kinda like when you assign a public variable by dragging the object to the inspector. I just don't want it to be visible in the inspector.
Thanks!
you can assign a public variable of a prefab from anywhere. you just can't assign non-prefabs to a prefab's variable. your solution would be to make a public game object and assign the prefab to that slot. this will work regardless of where the game object with this script is.
Answer by InvincibleCat · Feb 05, 2015 at 01:10 AM
just add [SerializeField] above your private field. That way it while still be private from script but editable from the inspector.