unity总结1
Camera mainCamera = GameObject.Find("Main
Camera").GetComponent();
Camera uiCamera = GameObject.Find("UICamera").GetComponent();
Vector3 startPos =
mainCamera.WorldToScreenPoint(startTarget.transform.position);//先转换到屏幕坐标
Vector3 endPos = endTarget.transform.position;
startPos =
uiCamera.ScreenToWorldPoint(startPos);//再转换到对象所在的Camera坐标系
target.transform.position = startPos;
Sequence seq = DOTween.Sequence();
seq.Append(target.transform.DoMove(endPos,1f,false));
seq.SetAutoKill(false);
seq.Play();
Animator animator = this.GetComponent();
RuntimeAnimatorController runtimeAnimatorController =
animator.runtimeAnimatorController;
AnimationClip[] clips =
runtimeAnimatorController.animationClips;
AnimationClip clip = null;
if (clips.Length > 0)
{
for (int i =
0; i < clips.Length; i++)
{
AnimationClip temp = clips[i];
AnimationEvent aniEvent = new AnimationEvent();
aniEvent.time = clip.length;
aniEvent.functionName = "ActionEnd";
clip.AddEvent(aniEvent);
}
}
GameObject obj = new GameObject();
Text testLab = obj.AddComponent();
testLab.font = Font.CreateDynamicFontFromOSFont("Arial",22);
testLab.text = "hello world";
testLab.fontStyle = FontStyle.BoldAndItalic;
testLab.fontSize = 35;
obj.layer = this.gameObject.layer;
obj.transform.SetParent(this.transform,false);
- [Unity3D学习]Unity代码热更新解决方案测试结果总结
- Unity5.x 项目升级过程中常见问题解决方案总结
- Unity中欧拉角总结版
- Unity5的ShaderVariants实验和总结
- Unity脚本-移动相关知识总结
- Unity 相关经典博客资源总结
- unity时间延迟方法总结(新人勿喷)
- Unity、NGUI性能优化方法总结
- Unity移动端优化总结
- Unity基础知识总结
- 【Unity】基础知识结构总结
- Unity中的Attribute使用总结
- unity 美术总结
- 在Unity的Gamma颜色空间下使用Standard Shader的总结
- 【《Effective C#》提炼总结】提高Unity中C#代码质量的21条准则
- Unity 相关经典博客资源总结(持续更新)
- 关于unity中支持的音频的格式和视频的格式的总结
- [Unity5.X]AssetBundle总结
- 如何优化内存?Unity中的内存种类;冯乐乐的总结的优化技术。
- 【转】【《Effective C#》提炼总结】提高Unity中C#代码质量的21条准则