Quantcast
Channel: Latest Questions by guto-thomas
Viewing all articles
Browse latest Browse all 84

Adding script in runtime makes pre-set fields null

$
0
0
Hello all, I have a script in the Assets folder with all the fields pre-set (those who show up above the script's text in the Inspector). When I add this script as a component to a GameObject manually (dragging it to the target game object) the fields stay populated as I specified(both in play and non-play mode) , but when I try to add the component via code, using AddComponent(), all the fields go blank. Is that expected behaviour? It'd so nice if this was allowed.

Viewing all articles
Browse latest Browse all 84

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>