void Start() { //Get the object's rigidbody objectRb = gameObject.GetComponent <Rigidbody>(); //If theres no special floating object, then that means the mesh is attached to this game object if (floatingObj == null) { floatingObj = gameObject; } //Init the script that will modify the mesh modifyFloatingMesh = new ModifyFloatingMesh(floatingObj); //Meshes that are below and above the water if (underWaterObj != null) { underWaterMesh = underWaterObj.GetComponent <MeshFilter>().mesh; } }
void OnEnable() { //Init the script that will modify the mesh modifyFloatingMesh = new ModifyFloatingMesh(floatingObj); GameManager.updatables = GameManager.updatables.Add(this); }