docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ImportConstant<T>

    Represents a constant in the ImporterGraph that contains a Value linked to a Node<TInput, TOutput> InputPorts.

    Inheritance
    object
    ImportConstant<T>
    Implements
    IConstantValue
    IDestinationEdge
    IEquatable<ImportConstant<T>>
    Inherited Members
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.Importer
    Assembly: Unity.Importer.dll
    Syntax
    [Serializable]
    public class ImportConstant<T> : IConstantValue, IDestinationEdge, IEquatable<ImportConstant<T>>
    Type Parameters
    Name Description
    T

    The setting's type.

    Remarks

    Constants can be added and removed from the ImporterGraph using AddImportConstant(IConstantValue) and RemoveImportConstant(IConstantValue).

    using UnityEngine.Importer;
    using UnityEngine;
    
    public class ExampleNode : Node<ExampleNode.MyInputs, ExampleNode.MyOutputs>
    {
        public class MyInputs : NodeInputs
        {
            public int ExampleInt;
        }
        public class MyOutputs : NodeOutputs
        {
        }
        public override void Run() {}
    }
    
    public static class ExampleClass
    {
        public static void AddNewConstantToAGraph()
        {
            var graph = ScriptableObject.CreateInstance<ImporterGraph>();
            var node = new ExampleNode();
            graph.AddNode(node);
            var newConstant = new ImportConstant<int>(5, node, nameof(ExampleNode.MyInputs.ExampleInt));
            graph.AddConstant(newConstant);
        }
    }

    Constructors

    ImportConstant(T, INode<InputPorts, OutputPorts>, string)

    Creates a new instance of a ImportConstant<T>.

    Declaration
    public ImportConstant(T value, INode<InputPorts, OutputPorts> destination, string destinationFieldName)
    Parameters
    Type Name Description
    T value

    The value of the constant.

    INode<InputPorts, OutputPorts> destination

    The Edge destination INode<TInput, TOutput>.

    string destinationFieldName

    The Edge destination input field on the destination INode<TInput, TOutput>.

    Properties

    Destination

    The NodePort destination of the edge.

    Declaration
    public NodePort Destination { get; }
    Property Value
    Type Description
    NodePort

    Type

    The Type of the constant.

    Declaration
    public Type Type { get; }
    Property Value
    Type Description
    Type

    Value

    The value of the constant.

    Declaration
    public T Value { get; }
    Property Value
    Type Description
    T

    Methods

    Equals(object)

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj
    Returns
    Type Description
    bool
    Overrides
    object.Equals(object)

    Equals(ImportConstant<T>)

    Declaration
    public bool Equals(ImportConstant<T> other)
    Parameters
    Type Name Description
    ImportConstant<T> other
    Returns
    Type Description
    bool

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int
    Overrides
    object.GetHashCode()

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    object.ToString()

    Implements

    IConstantValue
    IDestinationEdge
    IEquatable<T>
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)