Quantcast
Viewing latest article 19
Browse Latest Browse All 90

Answer by Matt-Downey

Ah, this seems to be the fault of not doing something like this instead: ball.timeToExplosion = length; Essentially, what you are doing is lacking the proper address to the variable you want to change. In order to make this work you have to make a few changes: 1) capitalize the "b" in your current "ball" class ("public class Ball") Note: I say this because it is convention to capitalize Classes and Functions for every word and use camelCase for any variables. 2) add this line in Start() or at the top: "public var ball : Ball = Ball();" 3) finalize by doing "ball.timeToExplosion = length;" to get the proper effect. again the periods are like an address. For an even more complex example look at this one: gameObject.thisScript.ball.timeToExplosion == Start at "gameObject"-->open component "thisScript"-->move to "ball" class-->access "timeToExplosion" variable in ball class

Viewing latest article 19
Browse Latest Browse All 90

Trending Articles