title: How to disable script for some objects in prefab?
body: <p>I've a moving script in prefab called &quot;player&quot;. So, my script works with camera and canvas too. But I need this script only for 'body'.</p>
  <p>[<img src="https://i.stack.imgur.com/BphE1.png" alt="enter image description here" />]</p>
  <p>Yes, I can't move this script into 'body', because I need this script for <code>Rigidbody2D</code>, Network Transform, and etc. Simply put, my script is locating in &quot;player&quot; prefab, I can't move it - that's all.</p>
  <pre><code>using System.Collections;
  using UnityEngine;
  
  public class PlayerController : MonoBehaviour
  {
      public float moveSpeedup;
      public float moveSpeeddown;
      public float rotateSpeed;
      public bool moveup;
      public bool movedown;
      public bool rotateleft;
      public bool rotateright;
      void Update()
      {
          if ((Input.GetKey(KeyCode.UpArrow)) || moveup)
          {
              transform.Translate(Vector3.right * moveSpeedup * Time.deltaTime);
          }
          if (Input.GetKey(KeyCode.DownArrow) || movedown)
          {
              transform.Translate(-Vector3.right * moveSpeeddown * Time.deltaTime);
          }
          if (Input.GetKey(KeyCode.RightArrow) || rotateleft)
          {
              transform.Rotate(Vector3.forward * rotateSpeed * Time.deltaTime);
          }
          if (Input.GetKey(KeyCode.LeftArrow) || rotateright)
          {
              transform.Rotate(Vector3.forward * -rotateSpeed * Time.deltaTime);
          }
      }
  }
  </code></pre>