首页 \ 问答 \ 为什么XJC生成@XmlElementRefs(Why XJC generates @XmlElementRefs)

为什么XJC生成@XmlElementRefs(Why XJC generates @XmlElementRefs)

我正在使用和XJC实用程序从xsd架构的JAXB注释类,我有点惊讶,不明白为什么生成@XmlElementRefs。 所有这些都发生在以下xsd片段中(此处省略了名称空间)

    <xs:complexType name="Header">
    <xs:sequence>
        <xs:element name="CarriedOver" type="xs:boolean" minOccurs="1" maxOccurs="1"/>
        <xs:element name="CheckId" type="xs:string" minOccurs="1" maxOccurs="1"/>
        <xs:element name="Closed" type="xs:boolean" minOccurs="1" maxOccurs="1"/>
        <xs:element name="Dob" type="xs:string" minOccurs="1" maxOccurs="1"/>
        <xs:element name="Employees" type="lb:Employee" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
                <xs:documentation>List&lt;Employee&gt;</xs:documentation>
            </xs:annotation>
        </xs:element>
        <xs:element name="GuestCountMode" type="ch:GuestCounting" minOccurs="1" maxOccurs="1"/>
        <xs:element name="Guests" type="xs:double" minOccurs="1" maxOccurs="1"/>
        <xs:element name="Managers" type="lb:Manager" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
                <xs:documentation>List&lt;Manager&gt;</xs:documentation>
            </xs:annotation>
        </xs:element>
        <xs:element name="Period" type="ch:TypeVal" minOccurs="1" maxOccurs="1"/>
        <xs:element name="PrintedCheckId" type="xs:string" minOccurs="1" maxOccurs="1"/>
        <xs:element name="RevCenter" type="ch:TypeVal" minOccurs="1" maxOccurs="1"/>
        <xs:element name="Room" type="ch:TypeStrVal" minOccurs="1" maxOccurs="1"/>
        <xs:element name="StoreId" type="xs:string" minOccurs="1" maxOccurs="1"/>
        <xs:element name="Table" type="ch:TypeStrVal" minOccurs="1" maxOccurs="1"/>
        <xs:element name="TableType" type="ch:TableTypeDef" minOccurs="1" maxOccurs="1"/>
        <xs:element name="TerminalId" type="xs:string" minOccurs="1" maxOccurs="1"/>
        <xs:element name="Times" type="ch:TimeStamp" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
                <xs:documentation>List&lt;TimeStamp&gt;</xs:documentation>
            </xs:annotation>
        </xs:element>
        <xs:element name="Training" type="xs:boolean" minOccurs="1" maxOccurs="1"/>
        <xs:element name="Managers" type="lb:Manager" minOccurs="0" maxOccurs="unbounded"/>
        <xs:element name="Times" type="ch:TimeStamp" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
</xs:complexType>

xjc生成的java类如下:

    package com.pif.check;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlElementRefs;
import javax.xml.bind.annotation.XmlType;
import com.pif.labor.Employee;
import com.pif.labor.Manager;


/**
 * <p>Java class for Header complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType name="Header">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="CarriedOver" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
 *         &lt;element name="CheckId" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         &lt;element name="Closed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
 *         &lt;element name="Dob" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         &lt;element name="Employees" type="{labor.pif.com}Employee" maxOccurs="unbounded" minOccurs="0"/>
 *         &lt;element name="GuestCountMode" type="{check.pif.com}GuestCounting"/>
 *         &lt;element name="Guests" type="{http://www.w3.org/2001/XMLSchema}double"/>
 *         &lt;element name="Managers" type="{labor.pif.com}Manager" maxOccurs="unbounded" minOccurs="0"/>
 *         &lt;element name="Period" type="{check.pif.com}TypeVal"/>
 *         &lt;element name="PrintedCheckId" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         &lt;element name="RevCenter" type="{check.pif.com}TypeVal"/>
 *         &lt;element name="Room" type="{check.pif.com}TypeStrVal"/>
 *         &lt;element name="StoreId" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         &lt;element name="Table" type="{check.pif.com}TypeStrVal"/>
 *         &lt;element name="TableType" type="{check.pif.com}TableTypeDef"/>
 *         &lt;element name="TerminalId" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         &lt;element name="Times" type="{check.pif.com}TimeStamp" maxOccurs="unbounded" minOccurs="0"/>
 *         &lt;element name="Training" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
 *         &lt;element name="Managers" type="{labor.pif.com}Manager" maxOccurs="unbounded" minOccurs="0"/>
 *         &lt;element name="Times" type="{check.pif.com}TimeStamp" maxOccurs="unbounded" minOccurs="0"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Header", propOrder = {
    "content"
})
public class Header {

    @XmlElementRefs({
        @XmlElementRef(name = "Guests", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "TableType", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "PrintedCheckId", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "RevCenter", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "Dob", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "Employees", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "Room", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "Table", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "Closed", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "GuestCountMode", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "Times", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "CheckId", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "Period", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "Managers", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "StoreId", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "TerminalId", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "Training", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "CarriedOver", type = JAXBElement.class, required = false)
    })
    protected List<JAXBElement<?>> content;

    /**
     * Gets the rest of the content model. 
     * 
     * <p>
     * You are getting this "catch-all" property because of the following reason: 
     * The field name "Managers" is used by two different parts of a schema. See: 
     * line 160 of file:/C:/Users/JS185350/Documents/WorkSpace/WorkspaceEA/schemas/pif/check.xsd
     * line 141 of file:/C:/Users/JS185350/Documents/WorkSpace/WorkspaceEA/schemas/pif/check.xsd
     * <p>
     * To get rid of this property, apply a property customization to one 
     * of both of the following declarations to change their names: 
     * Gets the value of the content property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the content property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getContent().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link JAXBElement }{@code <}{@link Double }{@code >}
     * {@link JAXBElement }{@code <}{@link String }{@code >}
     * {@link JAXBElement }{@code <}{@link TableTypeDef }{@code >}
     * {@link JAXBElement }{@code <}{@link TypeVal }{@code >}
     * {@link JAXBElement }{@code <}{@link Employee }{@code >}
     * {@link JAXBElement }{@code <}{@link String }{@code >}
     * {@link JAXBElement }{@code <}{@link TypeStrVal }{@code >}
     * {@link JAXBElement }{@code <}{@link Boolean }{@code >}
     * {@link JAXBElement }{@code <}{@link TypeStrVal }{@code >}
     * {@link JAXBElement }{@code <}{@link GuestCounting }{@code >}
     * {@link JAXBElement }{@code <}{@link TypeVal }{@code >}
     * {@link JAXBElement }{@code <}{@link String }{@code >}
     * {@link JAXBElement }{@code <}{@link TimeStamp }{@code >}
     * {@link JAXBElement }{@code <}{@link Manager }{@code >}
     * {@link JAXBElement }{@code <}{@link String }{@code >}
     * {@link JAXBElement }{@code <}{@link String }{@code >}
     * {@link JAXBElement }{@code <}{@link Boolean }{@code >}
     * {@link JAXBElement }{@code <}{@link Boolean }{@code >}
     * 
     * 
     */
    public List<JAXBElement<?>> getContent() {
        if (content == null) {
            content = new ArrayList<JAXBElement<?>>();
        }
        return this.content;
    }

}

对我来说,似乎奇怪的是所有内容都包含在JaxbElement中 - 这很难处理。 我希望有类似的东西:

public class Header {

  private Boolean CarriedOver;
  private String CheckId;
  private Boolean Closed;
  private String Dob;
  private List<Employee> Employees;
  ...

  propper getters and setters ...
}

有什么我想念的吗?


I am using and XJC utility for JAXB annotated classes from xsd schema and I am a bit surprised and don't understand why @XmlElementRefs gets generated. All happens in following xsd snippet (namespaces omitted here)

    <xs:complexType name="Header">
    <xs:sequence>
        <xs:element name="CarriedOver" type="xs:boolean" minOccurs="1" maxOccurs="1"/>
        <xs:element name="CheckId" type="xs:string" minOccurs="1" maxOccurs="1"/>
        <xs:element name="Closed" type="xs:boolean" minOccurs="1" maxOccurs="1"/>
        <xs:element name="Dob" type="xs:string" minOccurs="1" maxOccurs="1"/>
        <xs:element name="Employees" type="lb:Employee" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
                <xs:documentation>List&lt;Employee&gt;</xs:documentation>
            </xs:annotation>
        </xs:element>
        <xs:element name="GuestCountMode" type="ch:GuestCounting" minOccurs="1" maxOccurs="1"/>
        <xs:element name="Guests" type="xs:double" minOccurs="1" maxOccurs="1"/>
        <xs:element name="Managers" type="lb:Manager" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
                <xs:documentation>List&lt;Manager&gt;</xs:documentation>
            </xs:annotation>
        </xs:element>
        <xs:element name="Period" type="ch:TypeVal" minOccurs="1" maxOccurs="1"/>
        <xs:element name="PrintedCheckId" type="xs:string" minOccurs="1" maxOccurs="1"/>
        <xs:element name="RevCenter" type="ch:TypeVal" minOccurs="1" maxOccurs="1"/>
        <xs:element name="Room" type="ch:TypeStrVal" minOccurs="1" maxOccurs="1"/>
        <xs:element name="StoreId" type="xs:string" minOccurs="1" maxOccurs="1"/>
        <xs:element name="Table" type="ch:TypeStrVal" minOccurs="1" maxOccurs="1"/>
        <xs:element name="TableType" type="ch:TableTypeDef" minOccurs="1" maxOccurs="1"/>
        <xs:element name="TerminalId" type="xs:string" minOccurs="1" maxOccurs="1"/>
        <xs:element name="Times" type="ch:TimeStamp" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
                <xs:documentation>List&lt;TimeStamp&gt;</xs:documentation>
            </xs:annotation>
        </xs:element>
        <xs:element name="Training" type="xs:boolean" minOccurs="1" maxOccurs="1"/>
        <xs:element name="Managers" type="lb:Manager" minOccurs="0" maxOccurs="unbounded"/>
        <xs:element name="Times" type="ch:TimeStamp" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
</xs:complexType>

Generated java class by xjc is following:

    package com.pif.check;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlElementRefs;
import javax.xml.bind.annotation.XmlType;
import com.pif.labor.Employee;
import com.pif.labor.Manager;


/**
 * <p>Java class for Header complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType name="Header">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="CarriedOver" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
 *         &lt;element name="CheckId" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         &lt;element name="Closed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
 *         &lt;element name="Dob" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         &lt;element name="Employees" type="{labor.pif.com}Employee" maxOccurs="unbounded" minOccurs="0"/>
 *         &lt;element name="GuestCountMode" type="{check.pif.com}GuestCounting"/>
 *         &lt;element name="Guests" type="{http://www.w3.org/2001/XMLSchema}double"/>
 *         &lt;element name="Managers" type="{labor.pif.com}Manager" maxOccurs="unbounded" minOccurs="0"/>
 *         &lt;element name="Period" type="{check.pif.com}TypeVal"/>
 *         &lt;element name="PrintedCheckId" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         &lt;element name="RevCenter" type="{check.pif.com}TypeVal"/>
 *         &lt;element name="Room" type="{check.pif.com}TypeStrVal"/>
 *         &lt;element name="StoreId" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         &lt;element name="Table" type="{check.pif.com}TypeStrVal"/>
 *         &lt;element name="TableType" type="{check.pif.com}TableTypeDef"/>
 *         &lt;element name="TerminalId" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         &lt;element name="Times" type="{check.pif.com}TimeStamp" maxOccurs="unbounded" minOccurs="0"/>
 *         &lt;element name="Training" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
 *         &lt;element name="Managers" type="{labor.pif.com}Manager" maxOccurs="unbounded" minOccurs="0"/>
 *         &lt;element name="Times" type="{check.pif.com}TimeStamp" maxOccurs="unbounded" minOccurs="0"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Header", propOrder = {
    "content"
})
public class Header {

    @XmlElementRefs({
        @XmlElementRef(name = "Guests", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "TableType", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "PrintedCheckId", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "RevCenter", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "Dob", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "Employees", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "Room", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "Table", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "Closed", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "GuestCountMode", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "Times", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "CheckId", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "Period", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "Managers", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "StoreId", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "TerminalId", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "Training", type = JAXBElement.class, required = false),
        @XmlElementRef(name = "CarriedOver", type = JAXBElement.class, required = false)
    })
    protected List<JAXBElement<?>> content;

    /**
     * Gets the rest of the content model. 
     * 
     * <p>
     * You are getting this "catch-all" property because of the following reason: 
     * The field name "Managers" is used by two different parts of a schema. See: 
     * line 160 of file:/C:/Users/JS185350/Documents/WorkSpace/WorkspaceEA/schemas/pif/check.xsd
     * line 141 of file:/C:/Users/JS185350/Documents/WorkSpace/WorkspaceEA/schemas/pif/check.xsd
     * <p>
     * To get rid of this property, apply a property customization to one 
     * of both of the following declarations to change their names: 
     * Gets the value of the content property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the content property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getContent().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link JAXBElement }{@code <}{@link Double }{@code >}
     * {@link JAXBElement }{@code <}{@link String }{@code >}
     * {@link JAXBElement }{@code <}{@link TableTypeDef }{@code >}
     * {@link JAXBElement }{@code <}{@link TypeVal }{@code >}
     * {@link JAXBElement }{@code <}{@link Employee }{@code >}
     * {@link JAXBElement }{@code <}{@link String }{@code >}
     * {@link JAXBElement }{@code <}{@link TypeStrVal }{@code >}
     * {@link JAXBElement }{@code <}{@link Boolean }{@code >}
     * {@link JAXBElement }{@code <}{@link TypeStrVal }{@code >}
     * {@link JAXBElement }{@code <}{@link GuestCounting }{@code >}
     * {@link JAXBElement }{@code <}{@link TypeVal }{@code >}
     * {@link JAXBElement }{@code <}{@link String }{@code >}
     * {@link JAXBElement }{@code <}{@link TimeStamp }{@code >}
     * {@link JAXBElement }{@code <}{@link Manager }{@code >}
     * {@link JAXBElement }{@code <}{@link String }{@code >}
     * {@link JAXBElement }{@code <}{@link String }{@code >}
     * {@link JAXBElement }{@code <}{@link Boolean }{@code >}
     * {@link JAXBElement }{@code <}{@link Boolean }{@code >}
     * 
     * 
     */
    public List<JAXBElement<?>> getContent() {
        if (content == null) {
            content = new ArrayList<JAXBElement<?>>();
        }
        return this.content;
    }

}

To me it seems strange that all is wrapped in JaxbElement - it is hard to work with that. I would expect something like:

public class Header {

  private Boolean CarriedOver;
  private String CheckId;
  private Boolean Closed;
  private String Dob;
  private List<Employee> Employees;
  ...

  propper getters and setters ...
}

Is there something I am missing?


原文:https://stackoverflow.com/questions/20123171
更新时间:2023-03-03 10:03

最满意答案

你可以做几件事,但最好的事情可能是这样做:

public class CharacterControl
{

    void Update()
    {
        GameObject.FindGameObjectByTag("Tag-of-scoremanager-").GetComponent <ScoreManager> ().Score += price;


    }
}

另一种方法是将分数管理器作为检查器属性包括在内,如下所示:

ScoreManager manager;

然后将得分管理器预制件拖放到检查器中,然后增加它只需执行以下操作:

manager.Score += price;

There are several things that you could do, but the best thing is probably to do something like this:

public class CharacterControl
{

    void Update()
    {
        GameObject.FindGameObjectByTag("Tag-of-scoremanager-").GetComponent <ScoreManager> ().Score += price;


    }
}

Another way is for example to include the Score manager as an inspector property, like so:

ScoreManager manager;

and then drag and drop the score manager prefab into the inspector, and then to increment it simply do:

manager.Score += price;

相关问答

更多
  • 通过定位预制件的实例而不是预制件本身来更改对象的颜色。 使用Raycast找到游戏对象。 (由于您正在响应鼠标单击事件,我假设您正在选择要更改颜色的对象) private RaycastHit hit; void Update(){ Physics.Raycast (Camera.main.ScreenPointToRay (Input.mousePosition), out hit); if (Input.GetMouseButtonDown(1) && hit.collid ...
  • 我下载了项目并注意到顶部和左侧的生成点以错误的方式旋转。 左旋转应为:270(或-90) 顶部旋转应为:180 就个人而言,我会失去所有的旋转并使用transform.right等来避免混淆 I downloaded the project and noticed that the top & left spawnpoints were rotated the wrong way. The left rotation should be: 270 (or -90) The top rotation shou ...
  • 只需单击此按钮即可保存预制件: Simply click on this button will save your prefab:
  • 但是现在我面临的问题是我的相机旋转也受到我的预制父级旋转的影响 那是因为你的Camera是玩家的孩子所以它会做任何玩家/父母正在做的事情。 你的相机不应该在播放器下面。 删除它并确保它不是播放器或任何其他对象的子节点。 该脚本应该工作或使相机跟随播放器而不使Camera成为GameObject的孩子。 删除Player = GameObject.Find ("Player"); 来自LateUpdate函数。 您已在Start函数中完成此操作,因此无需在LateUpdate函数中执行此LateUpdate ...
  • 您可以尝试将简单的销毁脚本添加到您的死亡动画对象中,该对象会在一段时间内销毁对象或在动画中触发它( Unity手册:使用动画事件 )。 当您实例化对象时,它将出现在所需的位置,无论“主”对象如何,它都将被破坏。 像这样销毁脚本: void DestroyMyObject() { Destroy(gameObject); } 脚本运行时间: void Start() { Invoke ("DestroyMyObject", 1f); } void DestroyMyObject() ...
  • 通常我认为最好的方法是创建一个预制件然后给它一个公共组件或脚本,它可以接收消息并更改私有组件来控制你想要更改的方面。 在您描述的实例中,您只想更改图像组件,可以在实例化预制件时更改该组件。 问题变成了一个设计问题:您是否更愿意在实例化后从预制件中实例化游戏对象的脚本中更改属性(在本例中为图像组件)? 或者向预制件上的脚本发送消息,然后对该消息作出反应,相应地设置其属性? 您可以在此处看到有关实例化的相当全面和多样化的讨论。 我认为通常的共识是你不希望在大量的预制件上添加组件以“专门化”它们,并且你不想一次性 ...
  • 在场景中的游戏对象上这样的东西(可能是一个用作控制器的空游戏对象): 请注意,如果使用默认的摄像头方向,则光线投射的方向应为-Vector2.up 。 public class RayShooter : MonoBehaviour { void Update() { if(Input.GetMouseButtonDown(1)) // 1 is rightclick, don't know if you might want leftclick instead ...
  • 解决了! 我没有意识到有一个名为Debug.DrawRay的函数。 本质上,我没有意识到光线和线条的坐标不同。 我为测试目的绘制的线在局部空间中有一个特定点,因为它是第二个参数,与drawray一样,它是一个方向。 知道了这一点,我能够确定拳击的轨迹,就像之前一个朋克的拳头在完全狂野的方向上一样。 Solved it! I didn't realize that there was a function named Debug.DrawRay. in essence, I didn't realize th ...
  • 你可以做几件事,但最好的事情可能是这样做: public class CharacterControl { void Update() { GameObject.FindGameObjectByTag("Tag-of-scoremanager-").GetComponent ().Score += price; } } 另一种方法是将分数管理器作为检查器属性包括在内,如下所示: ScoreManager manager; 然后将 ...
  • 咦? 所以速度被覆盖并最终在所有实例化的预制件上都是相同的? 也许在Start方法中初始化speed变量时会有所帮助。 Huh? So the speed is overwritten and eventually ends up being the same on all instantiated prefabs? Maybe it helps if initialize the speed variable inside the Start method.

相关文章

更多

最新问答

更多
  • h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
  • 创建一个功能(Create a function)
  • 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
  • PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
  • Qt冻结循环的原因?(Qt freezing cause of the loop?)
  • TableView重复youtube-api结果(TableView Repeating youtube-api result)
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
  • 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
  • 以编程方式创建UITableView(Creating a UITableView Programmatically)
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
  • Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
  • 设置kotlin扩展名(Setting a kotlin extension)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 如何在vim中启用python3?(How to enable python3 in vim?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • dedecms如何安装?
  • 在哪儿学计算机最好?
  • 学php哪个的书 最好,本人菜鸟
  • 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
  • 如何覆盖错误堆栈getter(How to override Error stack getter)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
  • 电脑高中毕业学习去哪里培训
  • 正则表达式验证SMTP响应(Regex to validate SMTP Responses)