Quantcast
Channel: Latest Questions by Monko
Viewing all articles
Browse latest Browse all 34

How to create a variable in another object

$
0
0
In my game, I am creating many GameObjects in a 3 dimensional array like this: internal var chunks : GameObject[,,]; Now I want to put a variable into each game object. For example: chunks[1,0,3].newvariable : int = 4; In this case, I want to create a variable called "newvariable" into that particular gameobject. I also want to be able to access the variable later, like this: print(chunks[1,0,3].newvariable); This code doesn't work, so Im asking for your help to do this correctly. Can anyone help me accomplish this?

Viewing all articles
Browse latest Browse all 34

Trending Articles



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