- Home /
Duplicate Question - http://answers.unity3d.com/questions/1121757/help-getting-ambiguous-reference-error.html
Help, getting ambiguous reference error
using "using System;" causes error
"Object is an ambiguous reference between Unity.Object and object"
for spriteArray
I need to use "using System;" for "TimeSpan" and "DateTime" calculations
e.g.
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System;
public class arrayAndDateTimeTest : MonoBehaviour
{
public Object [] spriteArray;
private DateTime myDateTime;
private TimeSpan myTimeSpan;
// Use this for initialization
void Start ()
{
spriteArray = Resources.LoadAll ("EnergyBarSprites/Energy Bars"); //EnergyBarSprites
myDateTime = System.DateTime.Now;
myTimeSpan = TimeSpan.FromMinutes(10);
}
}
Answer by gjf · Jan 04, 2016 at 09:21 PM
why do you need System? UnityEngine has its own version of certain functions, which is why there's ambiguity.
unless you specifically need System, then don't include it and if you do, then reference the functions needed explicitly. ... something like System.DateTime, UnityEngine.Object, etc.
Follow this Question
Related Questions
Help, getting ambiguous reference error 1 Answer
inventory system issues 0 Answers
How to preserve array of custom objects in inspector? 0 Answers
Swapping elements of an array 1 Answer
Load Objects from a specific directory into a list? 0 Answers