本文整理汇总了C#中MonoBehaviour.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# MonoBehaviour.ToString方法的具体用法?C# MonoBehaviour.ToString怎么用?C# MonoBehaviour.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MonoBehaviour
的用法示例。
在下文中一共展示了MonoBehaviour.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeserializeObject
//! Deserialize whole hierarchy of object.
private void DeserializeObject(IFormatter Formatter, Stream Stream_, MonoBehaviour Object, Type ObjectType)
{
// Process all bases
Type base_type = ObjectType.BaseType;
if (base_type != null && !base_type.Equals(typeof(MonoBehaviour)))
DeserializeObject(Formatter, Stream_, Object, base_type);
// Read the type, must match
Type actual_type = (Type)Formatter.Deserialize(Stream_);
if (!ObjectType.Equals(actual_type))
throw new SerializationException("Deserialize: Actual type " + ObjectType.ToString() + " isn't equal to expected " + actual_type.ToString() + " when deserializing object " + Object.ToString());
// First number of objects
int number_ofobjects = (int)Formatter.Deserialize(Stream_);
// Now all fields
for (int i = 0; i < number_ofobjects; ++i)
{
// Get field name
string field = (string)Formatter.Deserialize(Stream_);
// Deserialize object
object deserialized_obj = Formatter.Deserialize(Stream_);
// Set value if valid - the field could be removed because of class
// definition change
FieldInfo field_info = GetFieldInfo(ObjectType, field);
if(field_info != null)
field_info.SetValue(Object, deserialized_obj);
}
}