I need help on objects attatched to the first person controller and ambient lighting

  1. How do I change the ambient lighting in scene 1 and scene 2
  2. How do I make an object attatched to the first person controller be showing in scene 2 but not in scene 1

Is there scripting involved for me to solve these problems?

2 Answers

2

You can kill both problems with a single script like this attached to the player:

public var sceneLight: Color; // set the scene ambient light in the Inspector
public var objectToShow: GameObject; // drag the object to show here
public var showObject: boolean; // should show (true) or hide (false) the object?

function Awake(){
    RenderSettings.ambientLight = sceneLight;
    objectToShow.SetActive(showObject);
}

Select the player and set the variables in each scene.

  1. Go to Edit > Render Settings and you’ll find the ambient light color field.
  2. You can simply add the object to the hierarchy of your player character in the scene 1. It will only carry over to the other scene IF this game object is a prefab and you click on “Apply” in the inspector window. “Apply” will modify the prefab itself according to this instance, and that will make this object you added appear on every instance of every scene this object appears.