A
A
Anton Rosin2020-12-11 23:45:47
C++ / C#
Anton Rosin, 2020-12-11 23:45:47

How to fix error CS0426?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;


public class PlayerScript : MonoBehaviour
{
    public float speed = 30;
    public float xMin, xMax, zMin, zMax;

    Rigidbody ship;
    void Start()
    {
        ship = GetComponent<Rigidbody>();
        //ship.velocity = new Vector3(15, 0, 10);
    }

    void Update()
    {
        float moveHorizontal = Input.GetAxis("Horizontal");
        float moveVertical = Input.GetAxis("Vertical");
        float clampedX = Mathf.Clamp(ship.position.x, xMin, xMax);
        float clampedZ = Mathf.Clamp(ship.position.z, zMin, zMax);

        ship.velocity = new Vector3(moveHorizontal, 0, moveVertical)*speed;
        ship.position = new Vector3(clampedX, 0, clampedZ);
        ship.rotation = new Quaternion.Euler(30, 0, -12);
    }
}


This code gives me an error, I don't know how to solve it:
The type name "Euler" dos not exist in the type "Quaternion"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2020-12-11
@Rosin886

ship.rotation = Quaternion.Euler(30, 0, -12);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question