Quantcast
Channel: Questions in topic: "clone"
Viewing all articles
Browse latest Browse all 508

Prefab clones with same script and different random number?

$
0
0
I'm instantiating several Prefabs of the same kind. These prefabs should be moving up and down. To make the animation I'm using iTween. void Start () { System.Random random = new System.Random(); int randomNumber = random.Next(0, 99); float delay = (float) randomNumber / 100; iTween.MoveBy(gameObject,iTween.Hash("y", 2,"time", 1, "looptype", "pingpong", "delay", 0)); } It seems every clone of the Prefab is using exactly this script (Start only called once). What would the correct way to do this be?

Viewing all articles
Browse latest Browse all 508

Latest Images

Trending Articles



Latest Images

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