C# 将实例化与精益吐温相结合
我想用lean tween缩放一个对象,但我也只是实例化它C# 将实例化与精益吐温相结合,c#,unity3d,instantiation,C#,Unity3d,Instantiation,我想用lean tween缩放一个对象,但我也只是实例化它 //this line instantiates the Gem gemList1.Add(Instantiate(Gem, new Vector2((xPos_Hole1 + (Random.Range(-20, 20))) * 2.0F, (-229 + (20 * i))), Quaternion.identity)); //This line animates the GEM by scaling it LeanTween.s
//this line instantiates the Gem
gemList1.Add(Instantiate(Gem, new Vector2((xPos_Hole1 + (Random.Range(-20, 20))) * 2.0F, (-229 + (20 * i))), Quaternion.identity));
//This line animates the GEM by scaling it
LeanTween.scale(Gem, new Vector3(1.7f, 1.7f, 1.7f), 5f).setEase(LeanTweenType.easeOutBounce);
如何组合下面的代码行?换句话说,我想在实例化预制件时对其进行缩放/设置动画
//this line instantiates the Gem
gemList1.Add(Instantiate(Gem, new Vector2((xPos_Hole1 + (Random.Range(-20, 20))) * 2.0F, (-229 + (20 * i))), Quaternion.identity));
//This line animates the GEM by scaling it
LeanTween.scale(Gem, new Vector3(1.7f, 1.7f, 1.7f), 5f).setEase(LeanTweenType.easeOutBounce);
实例化游戏对象时,将结果保存到临时变量中。将该临时变量添加到列表中,然后在
LeanTween.scale
函数中也使用该临时变量
//this line instantiates the Gem
GameObject tempObj = Instantiate(Gem, new Vector2((xPos_Hole1 + (Random.Range(-20, 20))) * 2.0F, (-229 + (20 * i))), Quaternion.identity);
//this line add the instantiated Gem to the List
gemList1.Add(tempObj);
//This line animates the GEM by scaling it
LeanTween.scale(tempObj, new Vector3(1.7f, 1.7f, 1.7f), 5f).setEase(LeanTweenType.easeOutBounce);
实例化游戏对象时,将结果保存到临时变量中。将该临时变量添加到列表中,然后在
LeanTween.scale
函数中也使用该临时变量
//this line instantiates the Gem
GameObject tempObj = Instantiate(Gem, new Vector2((xPos_Hole1 + (Random.Range(-20, 20))) * 2.0F, (-229 + (20 * i))), Quaternion.identity);
//this line add the instantiated Gem to the List
gemList1.Add(tempObj);
//This line animates the GEM by scaling it
LeanTween.scale(tempObj, new Vector3(1.7f, 1.7f, 1.7f), 5f).setEase(LeanTweenType.easeOutBounce);
谢谢你的回答谢谢你的回答