Giter Club home page Giter Club logo

Comments (4)

roboryantron avatar roboryantron commented on July 20, 2024 3

It is safe...

This is just an editor display issue, the data is in tact. What is happening is the inspector is assuming that it is resolving an asset reference rather than a scene object reference.

It is simple enough to make a custom editor for the inspector or to use a property drawer to get your display back for debugging. If you do not want to edit the data in the inspector, you can simply draw EditorGUI.ObjectField with allowSceneObjects true. If you do want it to be editable in the inspector it can get more complicated to do it genericly.

from unite2017.

Mixtrate avatar Mixtrate commented on July 20, 2024

I think this is due to the Scriptable object trying to reference a Gameobject, which would result in a type mismatch. I believe that the way Ryan implements this is a very clever way enable a reference to the gameobject.

For example in his ThingDisabler Script (which is a Monobehaviour) he can do this:

Set.Items[i].gameObject.SetActive(false);

which allows his to reference the "Set" and find gameobjects then delete them.

Really clever, not sure if I'm answering this correctly however.

from unite2017.

Mixtrate avatar Mixtrate commented on July 20, 2024

Some more proof to the previous answer.
If we change RuntimeSet to:

public abstract class RuntimeSet<T> : ScriptableObject
{
	public List<string> gameobjectNames = new List<string>();
	public List<T> Items = new List<T>();

	public void Add(T thing, string name)
	{
		if (!Items.Contains(thing))
			Items.Add(thing);
			gameobjectNames.Add(name);
	}

	public void Remove(T thing, string name)
	{
		if (Items.Contains(thing))
			Items.Remove(thing);
			gameobjectNames.Remove(name);

	}
}

and change Thing.cs to:

public class Thing : MonoBehaviour
{
	public ThingRuntimeSet RuntimeSet;

	private void OnEnable()
	{
		RuntimeSet.Add(this, this.name);
	}

	private void OnDisable()
	{
		RuntimeSet.Remove(this, this.name);
	}
}

we can see this is actually working.
image 1

from unite2017.

RomanZhu avatar RomanZhu commented on July 20, 2024

Yeah, i know it's working.
Assets can reference scene objects until new scene is loaded.

My question was: Can i ignore that "Type mismatch" labels and be sure nothing will suddenly break

from unite2017.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.