Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

cs(17,69): error CS0117: 'Quaternion' does not contain a definition for 'Identit

Discussion in 'Scripting' started by B4g3lz, Aug 23, 2020.

  1. B4g3lz

    B4g3lz

    Joined:
    Aug 23, 2020
    Posts:
    7
    I got this error once I wrote a script for my player's death and respawn from a tutorial video. How do I fix it?
    error CS0117: 'Quaternion' does not contain a definition for 'Identity'


    using UnityEngine;
    public class LevelManager : MonoBehaviour
    {
    public static LevelManager instance;
    public Transform respawnPoint;
    public GameObject playerPrefab;
    private void Awake() {
    instance = this;
    }
    void Respawn() {
    Instantiate(playerPrefab, respawnPoint.position, Quaternion.Identity);
    }
    }
     
  2. hpjohn

    hpjohn

    Joined:
    Aug 14, 2012
    Posts:
    2,190
  3. B4g3lz

    B4g3lz

    Joined:
    Aug 23, 2020
    Posts:
    7
  4. Yoreki

    Yoreki

    Joined:
    Apr 10, 2019
    Posts:
    2,590
    Hey, just to save you some troubles in the future:
    • When posting code please use code tags. People will ask you to, especially on longer code sniplets
    • Capilatization is very important. For the compiler 'Identifier' and 'identifier' are two completely different things. Thus if something does "not exist" which you think it should, check if you spelled it correctly. This will save you a lot of trouble in the future :)
     
    B4g3lz likes this.
  5. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,762
    Building on this, ALL punctuation, capitalization, spelling, all of this is critical.

    The most insidious is with the callback functions, such as Start() or OnTriggerEnter()... if you misspell (or mis-type) those, you WILL NOT receive a compiler error. Your code will just simply not work.

    For instance if you have a function
    void start()
    (with a lowercase
    s
    ), Unity will be happily trying to call
    void Start()
    , see that you don't have one, and your
    void start()
    code will never be called, and then your code will have other errors because of this. Same applies to all the other special messages on any object, such as collisions, triggers, updates, etc. When something doesn't work, always start with the spelling and punctuation and capitalization directly from the documentation.