- Home /
Is it possible to Change mesh also multi materials by a button or a key
Is it possible to Change mesh also multi materials by a button or a key
I'm so new in unity and c#, may I ask is that possible to use this way or something similar or better way?
Thank you
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ChangeMeshv2 : MonoBehaviour
{
[SerializeField] public MeshFilter modelYouWantToChange;
[System.Serializable]
public class Meshinfo
{
public Mesh modelYouWantToUse;
public Material[] Mats;
}
public Meshinfo[] Meshinfoss;
// Update is called once per frame
void Update()
{
if(Input.GetKeyDown(KeyCode.Space))
{
//modelYouWantToChange.mesh = modelYouWantToUse;
}
}
public void ChangeMeshWithButton()
{
//modelYouWantToChange.mesh = modelYouWantToUse;
}
}
ask1.jpg
(81.0 kB)
Comment
Your answer
Follow this Question
Related Questions
How to serialize an array of classes 1 Answer
Lists and Structs instead of Arrays? 4 Answers
Cant put material of Unity on mesh created with C4D 1 Answer
Warped texture on a non square quad 1 Answer