- Home /
 
Setting default values for a different class, similar to vector3
Im trying to create a class similar to Vector3, which allows the default values to be set in the editor.
I set the default values for Vector3 and Vector3i(my class) in a separate class.
 public Vector3 pos=new Vector3(0,5,0);
 public Vector3i centre=new Vector3i(0,5,0);
 
               In the editor it shows the default values for vector3 as x=0,y=5,z=0. But Vector3i(my class) sets the default values at x=0,y=0,z=0.
Vector3i(my class)
 using UnityEngine;
 using System.Collections;
 
 [System.Serializable]
 
 public class Vector3i{
  public int x,y,z;
  
  public Vector3i(int x,int y,int z){
  this.x=x;
  this.y=y;
  this.z=z;
  }
  
  public void convert(Vector3 v){
  x=Mathf.RoundToInt(v.x);
  y=Mathf.RoundToInt(v.y);
  z=Mathf.RoundToInt(v.z);
  }
  
 }
 
              
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
How to create a custom function out of script (See the answer for more) 1 Answer
How to catch a Vector3-value by clicking at a world position in editor mode? 2 Answers
decompile dll unity for vector3 1 Answer
How to stop scale reducing from reaching Zero (Solved) 1 Answer
Return a value for a class? 1 Answer