unity3d 常用的指令SetActive()、renderer .enabled 、collider.enabled

用Unity3d 时会隐藏一个物体,经常用到如下的命令,解释一下自己对一下3行代码的理解

private GameObject cub;

cub.gameObject.SetActive(true);类似下图圈出的,类似直接删除这个物体的存在,让它一切的属性隐藏。


cub.renderer .enabled = true ;这个代码是隐藏渲染,就是起到一个隐身的作用,其他的属性都在。


cub.collider.enabled  = true  ;这个是对碰撞体属性的配置,和下图圈出的操作等同。

  • 1
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
- NEW: Created a new layout system. All widgets and panels can now anchor to each other, the screen, and even 3D game objects. - NEW: You can now create resizable scroll views and anchor them to UI elements. - NEW: Re-created the Anchor Example to use the new anchoring system. - NEW: Updated all controls to use the new anchoring system. - NEW: You can now specify an explicit Render Queue on each panel. - NEW: Improved the Text List's functionality, adding support for touch interaction and having a scroll bar. - NEW: Recreated the Chat Window example -- it now features a resizable chat window. - NEW: Recreated the Drag & Drop example, adding two scroll views resized with screen height, and the ability to move items from one to the other. - NEW: Holding CTRL will now show the dimensions of the selected widget in the scene view. - NEW: Resizing the widget now automatically displays width and height guides in the scene view. - NEW: Selected anchored widgets and panels now show the calculated distance in the scene view. - NEW: Widget alpha is now fully cumulative (parents affect children). - NEW: UIDragObject script now ensures that the dragged object remains pixel-perfect. - NEW: UIDragObject script now can restrict the widget from being dragged off-screen. - NEW: Added a script that makes it possible to resize a widget by dragging on its corner or side. - NEW: UICamera.currentScheme tells you the current control scheme -- mouse, touch, or controller. - NEW: Button scripts have been modified to use the new OnDragOver/Out events - NEW: Added an option to the widget anchor to hide itself if it's off-screen. - NEW: Drag Object script now lets you specify an explicit bounds rectangle and has an improved inspector. - NEW: Added a button to UIButtonColor that can automatically replace it with a UIButton. - NEW: Added the ability to copy/paste all values of the sprites and labels via right-click on the component. - NEW: Added a "next page threshold" value to UICenterOnChild for when you want to swipe to move to the next page. - NEW: If the mouse events are off and touch events are on, NGUI will now fake touches using the mouse in the editor. - FIX: Changing panel depth in inspector will now reflect the change correctly. - FIX: Atlas/font selection dialog will now make searching of the entire project optional. - FIX: UICamera events will once again work independently of time scale. - FIX: Fixed the glitch that was causing widgets to jump into the middle of nowhere sometimes when resizing them. - FIX: UIDragScrollView will no longer try to find the scroll view if you set it manually. - FIX: Enabling and disabling textures and Unity 2D sprites will now again set the correct texture. - FIX: Adjusting depths via shortcut keys should now work consistently. - FIX: Draw call viewer will now display the correct triangle count. - FIX: NGUITools.SetActive will now automatically call CreatePanel on widgets, ensuring that there is no frame delay (read: blinking). - FIX: UICamera selected object change should now work multiple times per frame. - FIX: Added a new clause to panel depth comparison that uses panel instance IDs if the panel depth matches (to avoid depth collisions). - FIX: Max line count on labels should now work again. - FIX: Fixed the Drag Objects script on mobile devices. It was not applying momentum properly. - DEL: OnHover is no longer sent via selection changes. Listen to OnSelect and check (UICamera.currentScheme == ControlScheme.Controller). - DEL: "PMA Shader" option is now going to be permanently hidden once the atlas has been created. - DEL: Eliminated the half-pixel offset setting from anchors. - DEL: Removed anchor and stretch scripts from the menus. - NEW: Further improved the layout system's presentation, making it less daunting. - NEW: Enabling anchoring will automatically anchor to the first parent by default. - NEW: It's now possible to automatically anchor to the mid-points (sides, center). - NEW: Made it possible to move and scale anchored widgets. - FIX: Rotating a widget should no longer hide its side handles. - FIX: Mobile keyboard will now have the multi-line option. - FIX: Re-added support for packed fonts.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值