• Unity3D脚本编写错误汇集


    You are trying to create a MonoBehaviour using the 'new' keyword.  This is not allowed. 

    1 using UnityEngine;
    2 
    3 namespace Assets
    4 {
    5     public abstract class AbstractRotaryMovement:MonoBehaviour
    6     {
    7         public abstract void Whirling(GameObject gameObject,float x,float y,float z);
    8     }
    9 }
     1 using System.Threading.Tasks;
     2 using UnityEngine;
     3 
     4 namespace Assets
     5 {
     6     public class ConcreteRotaryMovement3D: AbstractRotaryMovement
     7     {
     8         public override void Whirling(GameObject gameObject,float x,float y,float z)
     9         {
    10             gameObject.transform.eulerAngles = new Vector3(x, y, z);
    11         }
    12         public int Hh()
    13         {
    14             return 22;
    15         }
     1 using UnityEngine;
     2 using System.Configuration;
     3 using System.Reflection;
     4 using System;
     5 
     6 public class MoveControl : MonoBehaviour
     7 {
     8     public ConcreteRotaryMovement3D concreteRotaryMovement3D = new ConcreteRotaryMovement3D();
     9     public TextClass textClass;
    10     // Start is called before the first frame update
    11     void Start()
    12     {
    13 
    14     }

    继承自MonoBehaviour的类,不允许被实例化

  • 相关阅读:
    Mybatis一级缓存和二级缓存总结
    UML模型的基本概念
    Proxy patten 代理模式
    UML 基础:类图
    Java与UML交互图
    Composite Pattern (组合模式)
    用例建模指南
    Prototype Pattern(原型模式)
    Adapter Pattern(适配器模式)
    UML 类与类之间的关系
  • 原文地址:https://www.cnblogs.com/f-t-q/p/10596843.html
Copyright © 2020-2023  润新知