Assign Material in view Unity part 4
Assign Material in view Unity part 4
comment p1
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System;
[InitializeOnLoad]
public class EditorStartup
{
static EditorStartup()
{
// PART 1. Hi
void Start()
{
characterController = GetComponent<CharacterController>();
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
if (!characterController.isGrounded)
{
moveDirection.y -= gravity * Time.deltaTime;
}
#endregion
if (canMove)
{
rotationX += -Input.GetAxis("Mouse Y") * lookSpeed;
rotationX = Mathf.Clamp(rotationX, -lookXLimit, lookXLimit);
playerCamera.transform.localRotation = Quaternion.Euler(rotationX,
0, 0);
transform.rotation *= Quaternion.Euler(0, Input.GetAxis("Mouse X") *
lookSpeed, 0);
}
#endregion
}
}
It’s full code, I hope it could help you to assign the same material fo many
onjects in Unity