Why would this happen.. I place a light and a sphere in the same position. But when I compile the game. The light is offset from the sphere. As I approach the Light and Sphere. The Light seems to move around the sphere and move off to the other side. If they a supposed to be in the same position, why then dose the light move all over the place?? I placed a flare on the light to watch what it is doing...
using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
[RequireComponent(typeof(Light))]
class SoloSystem :MonoBehaviour
{
public string SoloSystemName = "Unnamed";
public int SoloSystemID = 0;
public SunType Suntype = SunType.Type_O;
public List<Planet> Plants = new List<Planet>();
void Start()
{
GameObject Sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
Sphere.renderer.material.color = new Color(1.0f, 0.2f, 0.2f);
Sphere.transform.position = transform.position;
Sphere.transform.localScale = new Vector3(100.0f, 100.0f, 100.0f);
Sphere.renderer.castShadows = false;
Sphere.renderer.receiveShadows = false;
Sphere.light.enabled = true; // If I enable it turns off the other light...?? why
Sphere.light.range = (float)Suntype;
Sphere.light.intensity = (float)Suntype;
Label.target = Sphere.transform;
light.intensity = (float)Suntype; //Enum basically = 30000:int
light.range = (float)Suntype;
light.transform.position = Sphere.transform.position; // Trying to work out
light.transform.localScale = Sphere.transform.localScale; //trying to work out.
}
void Update()
{
}
}
I am new to this. So it might be something basic. I've only been playing around with it for 2 days...