how to add a constant force pulling all objects to 1 object

I have had trouble figuring out a code that would make a “center of gravity” if you will. I need all objects to be pulled to a center of a sphere, sort of like on earth. So that when you run along the sphere, you rotate so that your feet face the center of it. Any and all help is greatly appreciated. If you need any more details, feel free to ask.

Ok, this is a first wuick approach, but you maybe want to start with something like this :

using UnityEngine;
using System.Collections;

public class GravityField : MonoBehaviour {

	public Collider[] collidersToAffect;

	public float effectRadius = 0;

	public float gravityForce = 9.8f;

	public Color gizmoColor = Color.red;

	public LayerMask layers;

	// Use this for initialization
	void Start () {
	

	}
	
	// Update is called once per frame
	void Update () {
	
		collidersToAffect = Physics.OverlapSphere(transform.position, effectRadius, layers);

		foreach(Collider c in collidersToAffect) {

			Vector3 attractionDir = transform.position - c.transform.position;

			c.attachedRigidbody.AddForce(attractionDir * gravityForce, ForceMode.Force);

		}

	}

	void OnDrawGizmos() {

		Gizmos.color = gizmoColor;

		Gizmos.DrawWireSphere(transform.position, effectRadius);

	}

}

Here I leave you a link to the example scene : https://mega.co.nz/#!mgUUTTiS!BKnV9YhogU2wHlIMyTE4QNwOcJK0DU3D9T0X2X88T7E

It’s just a sphere with the script attached and some objects around.
The gravity would apply inside the gizmo.

For a more realistic behaviour you should modify it so the gravity force decreases with the distance. I’ll leave that to you so you can play around with the script ;). If you need more help just ask.