I got 15 Errors, unity says:
Assets/Scripts/Vehicles/Giftszene.cs(25,23): error CS1061: ‘GameObject’ does not contain a definition for ‘setActive’ and no accessible extension method ‘setActive’ accepting a first argument of type ‘GameObject’ could be found (are you missing a using directive or an assembly reference?)
Assets/Scripts/Vehicles/Giftszene.cs(26,13): error CS1622: Cannot return a value from an iterator. Use the yield return statement to return a value, or yield break to end the iteration.
Assets/Scripts/Vehicles/Giftszene.cs(26,13): error CS0127: Since ‘Giftszene.Update()’ returns void, a return keyword must not be followed by an object expression
Assets/Scripts/Vehicles/Giftszene.cs(18,10): error CS1624: The body of ‘Giftszene.Update()’ cannot be an iterator block because ‘void’ is not an iterator interface type
Assets/Scripts/Vehicles/Giftszene.cs(18,10): error CS1624: The body of ‘Giftszene.Update()’ cannot be an iterator block because ‘void’ is not an iterator interface type
Assets/Scripts/Vehicles/Giftszene.cs(28,10): error CS0103: The name ‘If’ does not exist in the current context
Assets/Scripts/Vehicles/Giftszene.cs(30,18): error CS1061: ‘GameObject’ does not contain a definition for ‘setActive’ and no accessible extension method ‘setActive’ accepting a first argument of type ‘GameObject’ could be found (are you missing a using directive or an assembly reference?)
Assets/Scripts/Vehicles/Giftszene.cs(34,18): error CS1061: ‘GameObject’ does not contain a definition for ‘setActive’ and no accessible extension method ‘setActive’ accepting a first argument of type ‘GameObject’ could be found (are you missing a using directive or an assembly reference?)
Assets/Scripts/Vehicles/Giftszene.cs(38,18): error CS1061: ‘GameObject’ does not contain a definition for ‘setActive’ and no accessible extension method ‘setActive’ accepting a first argument of type ‘GameObject’ could be found (are you missing a using directive or an assembly reference?)
Assets/Scripts/Vehicles/Giftszene.cs(42,18): error CS1061: ‘GameObject’ does not contain a definition for ‘setActive’ and no accessible extension method ‘setActive’ accepting a first argument of type ‘GameObject’ could be found (are you missing a using directive or an assembly reference?)
Assets/Scripts/Vehicles/Giftszene.cs(44,38): error CS0117: ‘KeyCode’ does not contain a definition for ‘Enter’
Assets/Scripts/Vehicles/Giftszene.cs(46,24): error CS1061: ‘GameObject’ does not contain a definition for ‘setActive’ and no accessible extension method ‘setActive’ accepting a first argument of type ‘GameObject’ could be found (are you missing a using directive or an assembly reference?)
Assets/Scripts/Vehicles/Giftszene.cs(47,21): error CS1061: ‘GameObject’ does not contain a definition for ‘setActive’ and no accessible extension method ‘setActive’ accepting a first argument of type ‘GameObject’ could be found (are you missing a using directive or an assembly reference?)
Assets/Scripts/Vehicles/Giftszene.cs(49,21): error CS1061: ‘GameObject’ does not contain a definition for ‘setActive’ and no accessible extension method ‘setActive’ accepting a first argument of type ‘GameObject’ could be found (are you missing a using directive or an assembly reference?)
Assets/Scripts/Vehicles/Giftszene.cs(50,13): error CS0103: The name ‘thePlayer’ does not exist in the current context
Assets/Scripts/Vehicles/Giftszene.cs(51,23): error CS1061: ‘GameObject’ does not contain a definition for ‘setActive’ and no accessible extension method ‘setActive’ accepting a first argument of type ‘GameObject’ could be found (are you missing a using directive or an assembly reference?)
I changed the script to the following:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Giftszene : MonoBehaviour
{
public GameObject player;
public GameObject playercam;
public GameObject mehl;
public GameObject salz;
public GameObject hefe;
public GameObject gift;
public GameObject kitchencam;
public GameObject roomcam;
void Update()
{
if (Input.GetKeyDown(KeyCode.M));
{
this.gameObject.GetComponent<BoxCollider>().enabled = false;
kitchencam.SetActive(true);
player.SetActive(false);
playercam.setActive(false);
return (null);
}
If (Input.GetKeyDown(KeyCode.F));
{
mehl.setActive(false);
}
if (Input.GetKeyDown(KeyCode.J))
{
salz.setActive(false);
}
if (Input.GetKeyDown(KeyCode.K))
{
hefe.setActive(false);
}
if (Input.GetKeyDown(KeyCode.H));
{
gift.setActive(false);
}
if (Input.GetKeyDown(KeyCode.Enter))
{
kitchencam.setActive(false);
roomcam.setActive(true);
yield return new WaitForSeconds(4);
roomcam.setActive(false);
thePlayer.setActive(true);
playercam.setActive(true);
}
}
}